summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-10 21:03:21 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-10 21:03:21 +0000
commit0b42191e0276eccc66257273970bae1e73c21896 (patch)
treec87f415ef71f1c48e9b1ccc38f4e78d1b89918ac /gcc/config
parent6cb7d18f626255743e566b3b9a79810afa98b014 (diff)
downloadgcc-0b42191e0276eccc66257273970bae1e73c21896.tar.gz
PR target/65368
* config/i386/i386.md (bmi2_bzhi_<mode>3): Removed define_insn, new define_expand. (*bmi2_bzhi_<mode>3, *bmi2_bzhi_<mode>3_1): New define_insns. * gcc.target/i386/bmi2-bzhi-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221335 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.md44
1 files changed, 39 insertions, 5 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 8a80415b9a5..1129b935a17 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -12678,18 +12678,52 @@
(set_attr "mode" "<MODE>")])
;; BMI2 instructions.
-(define_insn "bmi2_bzhi_<mode>3"
+(define_expand "bmi2_bzhi_<mode>3"
+ [(parallel
+ [(set (match_operand:SWI48 0 "register_operand")
+ (zero_extract:SWI48
+ (match_operand:SWI48 1 "nonimmediate_operand")
+ (umin:SWI48
+ (and:SWI48 (match_operand:SWI48 2 "register_operand")
+ (const_int 255))
+ (match_dup 3))
+ (const_int 0)))
+ (clobber (reg:CC FLAGS_REG))])]
+ "TARGET_BMI2"
+ "operands[3] = GEN_INT (<MODE_SIZE> * BITS_PER_UNIT);")
+
+(define_insn "*bmi2_bzhi_<mode>3"
[(set (match_operand:SWI48 0 "register_operand" "=r")
- (and:SWI48 (lshiftrt:SWI48 (const_int -1)
- (match_operand:SWI48 2 "register_operand" "r"))
- (match_operand:SWI48 1 "nonimmediate_operand" "rm")))
+ (zero_extract:SWI48
+ (match_operand:SWI48 1 "nonimmediate_operand" "rm")
+ (umin:SWI48
+ (and:SWI48 (match_operand:SWI48 2 "register_operand" "r")
+ (const_int 255))
+ (match_operand:SWI48 3 "const_int_operand" "n"))
+ (const_int 0)))
(clobber (reg:CC FLAGS_REG))]
- "TARGET_BMI2"
+ "TARGET_BMI2 && INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT"
"bzhi\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "bitmanip")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
+(define_mode_attr k [(SI "k") (DI "q")])
+(define_insn "*bmi2_bzhi_<mode>3_1"
+ [(set (match_operand:SWI48 0 "register_operand" "=r")
+ (zero_extract:SWI48
+ (match_operand:SWI48 1 "nonimmediate_operand" "rm")
+ (umin:SWI48
+ (zero_extend:SWI48 (match_operand:QI 2 "register_operand" "r"))
+ (match_operand:SWI48 3 "const_int_operand" "n"))
+ (const_int 0)))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_BMI2 && INTVAL (operands[3]) == <MODE_SIZE> * BITS_PER_UNIT"
+ "bzhi\t{%<k>2, %1, %0|%0, %1, %<k>2}"
+ [(set_attr "type" "bitmanip")
+ (set_attr "prefix" "vex")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "bmi2_pdep_<mode>3"
[(set (match_operand:SWI48 0 "register_operand" "=r")
(unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")