]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Add rtx_cost support for ORDERED comparison.
authorLulu Cheng <chenglulu@loongson.cn>
Tue, 14 Apr 2026 09:10:45 +0000 (17:10 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Wed, 6 May 2026 09:48:53 +0000 (17:48 +0800)
In commit 16-8400-g48c2ea1750efe4, VCOND_MASK is inverted
(if that would be an improvement).  However, since the LoongArch
backend does not define the rtx_cost for the ORDERED RTX, the
calculated cost for UNORDERED becomes greater than that of ORDERED.
This triggers an inversion from UNORDERED to ORDERED, leading to
test failures in lasx-vcond-2.c and lsx-vcond-2.c.

Since the assembly sequences generated for ORDERED and UNORDERED
are identical on LoongArch, I have set the rtx_cost for ORDERED
to match that of UNORDERED.  This ensures consistent cost
evaluation and allows the related test cases to pass.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_rtx_costs): Add
RTX cost handling for the ORDERED RTX code.

gcc/config/loongarch/loongarch.cc

index 4a0a9bafa8138b4751269ea1ffeb0e723e7aa2df..1ecf356ac6cb7d34ff1fc1811f7f74b3bf0aaa69 100644 (file)
@@ -4280,6 +4280,7 @@ loongarch_rtx_costs (rtx x, machine_mode mode, int outer_code,
     case EQ:
     case NE:
     case UNORDERED:
+    case ORDERED:
     case LTGT:
     case UNGE:
     case UNGT: