Fix the ICE:
../gcc/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c:88:1: internal compiler
error: output_operand: invalid use of '%t'
88 | }
| ^
The ICE is because we have an incorrect condition
"GET_MODE (op) != TImode": we may use (const_int 0) here but it is in
VOIDmode.
Use reg_or_0_operand instead of hand-written (and incorrect) logic to
fix it.
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_print_operand): Call
reg_or_0_operand for checking the sanity of for %t.
---
gcc/config/loongarch/loongarch.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/config/loongarch/loongarch.cc
b/gcc/config/loongarch/loongarch.cc
index 0935d7ba092..ef5d5f4e060 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6495,8 +6495,7 @@ loongarch_print_operand (FILE *file, rtx op, int letter)
break;
case 't':
- if (GET_MODE (op) != TImode
- || (op != CONST0_RTX (TImode) && code != REG))
+ if (!reg_or_0_operand (op, TImode))
{
output_operand_lossage ("invalid use of '%%%c'", letter);
break;
--
2.51.0