diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2024-08-01 09:58:48 +0200 |
---|---|---|
committer | Georg-Johann Lay <avr@gjlay.de> | 2024-08-01 10:42:35 +0200 |
commit | d0504847970d89d5dd7bd689ca8f7bf82fedf522 (patch) | |
tree | 26ce73dae6c77a6db771b03bbbf539c5297ca28f | |
parent | df2b444a233e93b987adec76655ab89589b3fa10 (diff) | |
download | gcc-d0504847970d89d5dd7bd689ca8f7bf82fedf522.zip gcc-d0504847970d89d5dd7bd689ca8f7bf82fedf522.tar.gz gcc-d0504847970d89d5dd7bd689ca8f7bf82fedf522.tar.bz2 |
AVR: Tweak register pressure for const_fixed compares against "M".
When comparing a 16-bit or 32-bit integer against a constant in
the range 0...0xff, constraint M is used because no scratch reg
is needed in that case. Same can be done for fixed-point compares.
gcc/
* config/avr/constraints.md (YMM): New constraint.
* config/avr/avr.md (cmp<mode>3, *cmp<mode>3)
(cbranch<mode>4_insn): Allow YMM where M is allowed.
-rw-r--r-- | gcc/config/avr/avr.md | 28 | ||||
-rw-r--r-- | gcc/config/avr/constraints.md | 7 |
2 files changed, 21 insertions, 14 deletions
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 91a306f..02d0a41 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -6568,9 +6568,9 @@ ;; "cmpha3" "cmpuha3" (define_insn "cmp<mode>3" [(set (reg:CC REG_CC) - (compare:CC (match_operand:ALL2 0 "register_operand" "!w ,r ,r,d ,r ,d,r") - (match_operand:ALL2 1 "nonmemory_operand" "Y00,Y00,r,s ,s ,M,n Ynn"))) - (clobber (match_scratch:QI 2 "=X ,X ,X,&d,&d ,X,&d"))] + (compare:CC (match_operand:ALL2 0 "register_operand" "!w ,r ,r,d ,r ,d ,r") + (match_operand:ALL2 1 "nonmemory_operand" "Y00,Y00,r,s ,s ,M YMM,n Ynn"))) + (clobber (match_scratch:QI 2 "=X ,X ,X,&d,&d,X ,&d"))] "reload_completed" { switch (which_alternative) @@ -6635,9 +6635,9 @@ ;; "*cmpsa" "*cmpusa" (define_insn "*cmp<mode>" [(set (reg:CC REG_CC) - (compare:CC (match_operand:ALL4 0 "register_operand" "r ,r ,d,r ,r") - (match_operand:ALL4 1 "nonmemory_operand" "Y00,r ,M,M ,n Ynn"))) - (clobber (match_scratch:QI 2 "=X ,X ,X,&d,&d"))] + (compare:CC (match_operand:ALL4 0 "register_operand" "r ,r ,d ,r") + (match_operand:ALL4 1 "nonmemory_operand" "Y00,r ,M YMM,n Ynn"))) + (clobber (match_scratch:QI 2 "=X ,X ,X ,&d"))] "reload_completed" { if (0 == which_alternative) @@ -6647,8 +6647,8 @@ return avr_out_compare (insn, operands, NULL); } - [(set_attr "length" "4,4,4,5,8") - (set_attr "adjust_len" "tstsi,*,compare,compare,compare")]) + [(set_attr "length" "4,4,4,8") + (set_attr "adjust_len" "tstsi,*,compare,compare")]) ;; A helper for avr_pass_ifelse::avr_rest_of_handle_ifelse(). @@ -6727,11 +6727,11 @@ [(set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator" - [(match_operand:ALL4 1 "register_operand" "r ,r,d,r ,r") - (match_operand:ALL4 2 "nonmemory_operand" "Y00,r,M,M ,n Ynn")]) + [(match_operand:ALL4 1 "register_operand" "r ,r,d ,r") + (match_operand:ALL4 2 "nonmemory_operand" "Y00,r,M YMM ,n Ynn")]) (label_ref (match_operand 3)) (pc))) - (clobber (match_scratch:QI 4 "=X ,X,X,&d,&d"))] + (clobber (match_scratch:QI 4 "=X ,X,X ,&d"))] "" "#" "reload_completed" @@ -6772,11 +6772,11 @@ [(set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator" - [(match_operand:ALL2 1 "register_operand" "!w ,r ,r,d ,r ,d,r") - (match_operand:ALL2 2 "nonmemory_operand" "Y00,Y00,r,s ,s ,M,n Ynn")]) + [(match_operand:ALL2 1 "register_operand" "!w ,r ,r,d ,r ,d ,r") + (match_operand:ALL2 2 "nonmemory_operand" "Y00,Y00,r,s ,s ,M YMM,n Ynn")]) (label_ref (match_operand 3)) (pc))) - (clobber (match_scratch:QI 4 "=X ,X ,X,&d,&d,X,&d"))] + (clobber (match_scratch:QI 4 "=X ,X ,X,&d,&d,X ,&d"))] "" "#" "reload_completed" diff --git a/gcc/config/avr/constraints.md b/gcc/config/avr/constraints.md index 3544861..963e23a 100644 --- a/gcc/config/avr/constraints.md +++ b/gcc/config/avr/constraints.md @@ -313,6 +313,13 @@ (and (match_code "const_fixed") (match_test "IN_RANGE (INTVAL (avr_to_int_mode (op)), -63, 63)"))) +;; Similar to "M", but for CONST_FIXED. + +(define_constraint "YMM" + "Fixed-point constant in the range 0 @dots{} 0xff when viewed as CONST_INT." + (and (match_code "const_fixed") + (match_test "IN_RANGE (INTVAL (avr_to_int_mode (op)), 0, 0xff)"))) + (define_constraint "Yil" "Memory in the lower half of the I/O space." (and (match_code "mem") |