]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Use force_lowpart_subreg in a BFI splitter [PR119133]
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 16 Apr 2025 12:20:27 +0000 (13:20 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 16 Apr 2025 12:20:27 +0000 (13:20 +0100)
lowpart_subreg ICEs are the gift that keeps giving.  This is another
case where we need to use force_lowpart_subreg instead, to handle
cases where the input is already a subreg and where the combined
subreg is not allowed as a single operation.

We don't need to check can_create_pseudo_p since the input should
be a hard register rather than a subreg if !can_create_pseudo_p.

gcc/
PR target/119133
* config/aarch64/aarch64.md
(*aarch64_bfi<GPI:mode><ALLX:mode>_<SUBDI_BITS>): Use
force_lowpart_subreg.

gcc/testsuite/
PR target/119133
* gcc.dg/torture/pr119133.c: New test.

(cherry picked from commit 5ae621e2e86c00d1fb13ef6839d0c3bace762ac8)

gcc/config/aarch64/aarch64.md
gcc/testsuite/gcc.dg/torture/pr119133.c [new file with mode: 0644]

index d3c381e82ce4fa70be1f441184236681b4184742..1be8322c4ee0926648b05ded8d89a82c23a15f0e 100644 (file)
                          (match_dup 1))
        (match_dup 2))]
   {
-    operands[2] = lowpart_subreg (<GPI:MODE>mode, operands[2],
-                                 <ALLX:MODE>mode);
+    operands[2] = force_lowpart_subreg (<GPI:MODE>mode, operands[2],
+                                       <ALLX:MODE>mode);
   }
   [(set_attr "type" "bfm,neon_ins_q,neon_ins_q")
    (set_attr "arch" "*,simd,simd")]
diff --git a/gcc/testsuite/gcc.dg/torture/pr119133.c b/gcc/testsuite/gcc.dg/torture/pr119133.c
new file mode 100644 (file)
index 0000000..f0c8f73
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-additional-options "-fno-tree-ter" } */
+/* { dg-require-effective-target float16 } */
+/* { dg-add-options float16 } */
+
+int
+foo(_Float16 f, int i)
+{
+  __builtin_memcpy(&i, &f, 2);
+  return i;
+}