From: Uros Bizjak Date: Mon, 25 Nov 2024 19:04:38 +0000 (+0100) Subject: i386: Generalize x >> 32-y to x >> -y conversion with multiples of 32 X-Git-Tag: basepoints/gcc-16~3896 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=551fd4d5c98859522dd21db6fbb39fceac3936b2;p=thirdparty%2Fgcc.git i386: Generalize x >> 32-y to x >> -y conversion with multiples of 32 Optimize also cases where immediate value is a multiple of 32 for 32-bit shifts (or multiple of 64 for 64-bit shifts). gcc/ChangeLog: * config/i386/i386.md (*ashl3_negcnt): For SImode shifts allow multiples of 32 (or multiples of 64 for DImode shifts) for immediate operand 3. (*ashl3_negcnt_1): Ditto. (*3_negcnt): Ditto. (*3_negcnt_1): Ditto. --- diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 399a6a81f9ca..df78e4df9d82 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -15906,7 +15906,7 @@ (match_operand 2 "int248_register_operand" "c,r")) 0))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (ASHIFT, mode, operands) - && INTVAL (operands[3]) == * BITS_PER_UNIT + && (INTVAL (operands[3]) & ( * BITS_PER_UNIT - 1)) == 0 && ix86_pre_reload_split ()" "#" "&& 1" @@ -15936,7 +15936,7 @@ (match_operand:QI 2 "register_operand" "c,r")))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (ASHIFT, mode, operands) - && INTVAL (operands[3]) == * BITS_PER_UNIT + && (INTVAL (operands[3]) & ( * BITS_PER_UNIT - 1)) == 0 && ix86_pre_reload_split ()" "#" "&& 1" @@ -16688,7 +16688,7 @@ (match_operand 2 "int248_register_operand" "c,r")) 0))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (, mode, operands) - && INTVAL (operands[3]) == * BITS_PER_UNIT + && (INTVAL (operands[3]) & ( * BITS_PER_UNIT - 1)) == 0 && ix86_pre_reload_split ()" "#" "&& 1" @@ -16718,7 +16718,7 @@ (match_operand:QI 2 "register_operand" "c,r")))) (clobber (reg:CC FLAGS_REG))] "ix86_binary_operator_ok (, mode, operands) - && INTVAL (operands[3]) == * BITS_PER_UNIT + && (INTVAL (operands[3]) & ( * BITS_PER_UNIT - 1)) == 0 && ix86_pre_reload_split ()" "#" "&& 1"