LoongArch: Fix "-mexplict-relocs=none -mcmodel=medium" producing %call36 when the assembler does not support it

Message ID 20231118174554.25661-2-xry111@xry111.site
State Unresolved
Headers
Series LoongArch: Fix "-mexplict-relocs=none -mcmodel=medium" producing %call36 when the assembler does not support it |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Xi Ruoyao Nov. 18, 2023, 5:45 p.m. UTC
  Even if !HAVE_AS_SUPPORT_CALL36, const_call_insn_operand should still
return false when -mexplict-relocs=none -mcmodel=medium to make
loongarch_legitimize_call_address emit la.local or la.global.

gcc/ChangeLog:

	* config/loongarch/predicates.md (const_call_insn_operand):
	Remove buggy "HAVE_AS_SUPPORT_CALL36" conditions.  Change "1" to
	"true" to make the coding style consistent.
---

Not fully regtested, but it should be obvious and it indeed fixes the
func-call-medium-*.c test failures.  Ok for trunk?

 gcc/config/loongarch/predicates.md | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gcc/config/loongarch/predicates.md b/gcc/config/loongarch/predicates.md
index 56f7c48e126..d02e846cb12 100644
--- a/gcc/config/loongarch/predicates.md
+++ b/gcc/config/loongarch/predicates.md
@@ -444,21 +444,19 @@  (define_predicate "const_call_insn_operand"
     case SYMBOL_PCREL:
       if (TARGET_CMODEL_EXTREME
 	  || (TARGET_CMODEL_MEDIUM
-	      && HAVE_AS_SUPPORT_CALL36
 	      && (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)))
 	return false;
       else
-	return 1;
+	return true;
 
     case SYMBOL_GOT_DISP:
       if (TARGET_CMODEL_EXTREME
 	  || !flag_plt
 	  || (flag_plt && TARGET_CMODEL_MEDIUM
-	      && HAVE_AS_SUPPORT_CALL36
 	      && (la_opt_explicit_relocs == EXPLICIT_RELOCS_NONE)))
 	return false;
       else
-	return 1;
+	return true;
 
     default:
       return false;