diff mbox series

arm: Fix ICEs in no-literal-pool.c on MVE

Message ID 20200929134738.5tfqpnrpsbr62p6e@arm.com
State New
Headers show
Series arm: Fix ICEs in no-literal-pool.c on MVE | expand

Commit Message

Alex Coplan Sept. 29, 2020, 1:47 p.m. UTC
Hello,

This patch fixes ICEs when compiling
gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool.c with
-mfp16-format=ieee -mfloat-abi=hard -march=armv8.1-m.main+mve
-mpure-code.

The existing conditions in the movsf/movdf expanders (as well as the
no_literal_pool patterns) were too restrictive, requiring
TARGET_HARD_FLOAT instead of TARGET_VFP_BASE, which caused unrecognised
insns when compiling this testcase with integer MVE and -mpure-code.

Testing:
 * Bootstrapped and regtested on arm-none-linux-gnueabihf.
 * Regtested an MVE cross build.

Comparison of test results before/after patch on MVE build:

UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0   scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0   scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0  (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1   scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1   scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1  (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fno-use-linker-plugin -flto-partition=none -ffat-lto-objects  scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fno-use-linker-plugin -flto-partition=none -ffat-lto-objects  scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fno-use-linker-plugin -flto-partition=none -ffat-lto-objects (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects  scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects  scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2   scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2   scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2  (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions   scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions   scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os   scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os   scan-assembler text,"0x20000006"
FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os  (test for excess errors)
UNRESOLVED->PASS: gcc.target/arm/thumb2-slow-flash-data-1.c scan-assembler-not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
FAIL->PASS: gcc.target/arm/thumb2-slow-flash-data-1.c (test for excess errors)

OK for trunk?

Thanks,
Alex

---

gcc/ChangeLog:

	* config/arm/arm.md (movsf): Relax TARGET_HARD_FLOAT to
	TARGET_VFP_BASE.
	(movdf): Likewise.
	* config/arm/vfp.md (no_literal_pool_df_immediate): Likewise.
	(no_literal_pool_sf_immediate): Likewise.

Comments

Kyrylo Tkachov Sept. 29, 2020, 4:32 p.m. UTC | #1
Hi Alex,

> -----Original Message-----
> From: Alex Coplan <Alex.Coplan@arm.com>
> Sent: 29 September 2020 14:48
> To: gcc-patches@gcc.gnu.org
> Cc: nickc@redhat.com; Richard Earnshaw <Richard.Earnshaw@arm.com>;
> Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>; Kyrylo
> Tkachov <Kyrylo.Tkachov@arm.com>
> Subject: [PATCH] arm: Fix ICEs in no-literal-pool.c on MVE
> 
> Hello,
> 
> This patch fixes ICEs when compiling
> gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool.c with
> -mfp16-format=ieee -mfloat-abi=hard -march=armv8.1-m.main+mve
> -mpure-code.
> 
> The existing conditions in the movsf/movdf expanders (as well as the
> no_literal_pool patterns) were too restrictive, requiring
> TARGET_HARD_FLOAT instead of TARGET_VFP_BASE, which caused
> unrecognised
> insns when compiling this testcase with integer MVE and -mpure-code.
> 
> Testing:
>  * Bootstrapped and regtested on arm-none-linux-gnueabihf.
>  * Regtested an MVE cross build.
> 
> Comparison of test results before/after patch on MVE build:
> 
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0
> scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0
> scan-assembler text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O0  (test for
> excess errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1
> scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1
> scan-assembler text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O1  (test for
> excess errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -
> fno-use-linker-plugin -flto-partition=none -ffat-lto-objects  scan-assembler-
> not \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -
> fno-use-linker-plugin -flto-partition=none -ffat-lto-objects  scan-assembler
> text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fno-use-
> linker-plugin -flto-partition=none -ffat-lto-objects (test for excess errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -
> fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects  scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -
> fuse-linker-plugin -fno-fat-lto-objects -ffat-lto-objects  scan-assembler
> text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c  -O2 -flto -fuse-
> linker-plugin -fno-fat-lto-objects -ffat-lto-objects (test for excess errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2
> scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2
> scan-assembler text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O2  (test for
> excess errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -
> fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions
> scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -
> fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions
> scan-assembler text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -O3 -fomit-frame-
> pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  (test for excess
> errors)
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os
> scan-assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> UNRESOLVED->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os
> scan-assembler text,"0x20000006"
> FAIL->PASS: gcc.target/arm/pure-code/no-literal-pool.c   -Os  (test for
> excess errors)
> UNRESOLVED->PASS: gcc.target/arm/thumb2-slow-flash-data-1.c scan-
> assembler-not
> \\.(float|l\\?double|d?byte|short|int|long|quad|word)\\s+[^.]
> FAIL->PASS: gcc.target/arm/thumb2-slow-flash-data-1.c (test for excess
> errors)
> 
> OK for trunk?

Ok.
Thanks,
Kyrill

> 
> Thanks,
> Alex
> 
> ---
> 
> gcc/ChangeLog:
> 
> 	* config/arm/arm.md (movsf): Relax TARGET_HARD_FLOAT to
> 	TARGET_VFP_BASE.
> 	(movdf): Likewise.
> 	* config/arm/vfp.md (no_literal_pool_df_immediate): Likewise.
> 	(no_literal_pool_sf_immediate): Likewise.
diff mbox series

Patch

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 147c4a50c72..1a8e498ba4c 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -7357,7 +7357,7 @@  (define_expand "movsf"
   if (arm_disable_literal_pool
       && (REG_P (operands[0]) || SUBREG_P (operands[0]))
       && CONST_DOUBLE_P (operands[1])
-      && TARGET_HARD_FLOAT
+      && TARGET_VFP_BASE
       && !vfp3_const_double_rtx (operands[1]))
     {
       rtx clobreg = gen_reg_rtx (SFmode);
@@ -7454,7 +7454,7 @@  (define_expand "movdf"
   if (arm_disable_literal_pool
       && (REG_P (operands[0]) || SUBREG_P (operands[0]))
       && CONSTANT_P (operands[1])
-      && TARGET_HARD_FLOAT
+      && TARGET_VFP_BASE
       && !arm_const_double_rtx (operands[1])
       && !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1])))
     {
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 72707c17929..e6c287c1a85 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -2125,7 +2125,7 @@  (define_insn_and_split "no_literal_pool_df_immediate"
 	(match_operand:DF 1 "const_double_operand" "F"))
    (clobber (match_operand:DF 2 "s_register_operand" "=r"))]
   "arm_disable_literal_pool
-   && TARGET_HARD_FLOAT
+   && TARGET_VFP_BASE
    && !arm_const_double_rtx (operands[1])
    && !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1]))"
   "#"
@@ -2151,7 +2151,7 @@  (define_insn_and_split "no_literal_pool_sf_immediate"
 	(match_operand:SF 1 "const_double_operand" "E"))
    (clobber (match_operand:SF 2 "s_register_operand" "=r"))]
   "arm_disable_literal_pool
-   && TARGET_HARD_FLOAT
+   && TARGET_VFP_BASE
    && !vfp3_const_double_rtx (operands[1])"
   "#"
   ""