aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/aarch64/predicates.md
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2018-01-17 16:31:42 +0000
committerWilco Dijkstra <wilco@gcc.gnu.org>2018-01-17 16:31:42 +0000
commitc0bb5bc54feab4bac0df04f358ec9e839a32b2a2 (patch)
treed60853b6b564dede8ede977b91f00593a440328b /gcc/config/aarch64/predicates.md
parentdd4770ec17abd5b6954144b882c291ded188cf56 (diff)
downloadgcc-c0bb5bc54feab4bac0df04f358ec9e839a32b2a2.zip
gcc-c0bb5bc54feab4bac0df04f358ec9e839a32b2a2.tar.gz
gcc-c0bb5bc54feab4bac0df04f358ec9e839a32b2a2.tar.bz2
[AArch64] PR82964: Fix 128-bit immediate ICEs
This fixes PR82964 which reports ICEs for some CONST_WIDE_INT immediates. It turns out decimal floating point CONST_DOUBLE get changed into CONST_WIDE_INT without checking the constraint on the operand, which results in failures. Avoid this by only allowing SF/DF/TF mode floating point constants in aarch64_legitimate_constant_p. A similar issue can occur with 128-bit immediates which may be emitted even when disallowed in aarch64_legitimate_constant_p, and the constraints in movti_aarch64 don't match. Fix this with a new constraint and allowing valid immediates in aarch64_legitimate_constant_p. Rather than allowing all 128-bit immediates and expanding in up to 8 MOV/MOVK instructions, limit them to 4 instructions and use a literal load for other cases. Improve a few TImode tests to use a literal and ensure they are skipped with -fpic. This fixes all reported failures. gcc/ PR target/82964 * config/aarch64/aarch64.md (movti_aarch64): Use Uti constraint. * config/aarch64/aarch64.c (aarch64_mov128_immediate): New function. (aarch64_legitimate_constant_p): Just support CONST_DOUBLE SF/DF/TF mode to avoid creating illegal CONST_WIDE_INT immediates. * config/aarch64/aarch64-protos.h (aarch64_mov128_immediate): Add declaration. * config/aarch64/constraints.md (aarch64_movti_operand): Limit immediates. * config/aarch64/predicates.md (Uti): Add new constraint. gcc/testsuite/ PR target/79041 PR target/82964 * gcc.target/aarch64/pr79041-2.c: Improve test, disable with fpic. * gcc.target/aarch64/pr78733.c: Improve test, disable with fpic. Co-Authored-By: Richard Sandiford <richard.sandiford@linaro.org> From-SVN: r256800
Diffstat (limited to 'gcc/config/aarch64/predicates.md')
-rw-r--r--gcc/config/aarch64/predicates.md13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
index 0df1a4d..159e74a 100644
--- a/gcc/config/aarch64/predicates.md
+++ b/gcc/config/aarch64/predicates.md
@@ -293,15 +293,14 @@
(match_test "aarch64_mov_operand_p (op, mode)"))))
(define_predicate "aarch64_movti_operand"
- (and (match_code "reg,subreg,mem,const_int")
- (ior (match_operand 0 "register_operand")
- (ior (match_operand 0 "memory_operand")
- (match_operand 0 "const_int_operand")))))
+ (ior (match_operand 0 "register_operand")
+ (match_operand 0 "memory_operand")
+ (and (match_operand 0 "const_scalar_int_operand")
+ (match_test "aarch64_mov128_immediate (op)"))))
(define_predicate "aarch64_reg_or_imm"
- (and (match_code "reg,subreg,const_int")
- (ior (match_operand 0 "register_operand")
- (match_operand 0 "const_int_operand"))))
+ (ior (match_operand 0 "register_operand")
+ (match_operand 0 "const_scalar_int_operand")))
;; True for integer comparisons and for FP comparisons other than LTGT or UNEQ.
(define_special_predicate "aarch64_comparison_operator"