(set_attr "mode" "SI")])
; As bsr is undefined behavior on zero and for other input
-; values it is in range 0 to 63, we can optimize away sign-extends.
-(define_insn_and_split "*bsr_rex64_2"
+; values it is in range 0 to 63, we can optimize away sign-extends
+; or zero-extends.
+(define_insn_and_split "*bsr_rex64<u>_2"
[(set (match_operand:DI 0 "register_operand")
(xor:DI
- (sign_extend:DI
+ (any_extend:DI
(minus:SI
(const_int 63)
(subreg:SI (clz:DI (match_operand:DI 1 "nonimmediate_operand"))
operands[3] = lowpart_subreg (SImode, operands[2], DImode);
})
-(define_insn_and_split "*bsr_2"
+(define_insn_and_split "*bsr<u>_2"
[(set (match_operand:DI 0 "register_operand")
- (sign_extend:DI
+ (any_extend:DI
(xor:SI
(minus:SI
(const_int 31)
(minus:DI
(match_operand:DI 2 "const_int_operand")
(xor:DI
- (sign_extend:DI
+ (any_extend:DI
(minus:SI (const_int 63)
(subreg:SI
(clz:DI (match_operand:DI 1 "nonimmediate_operand"))
[(set (match_operand:DI 0 "register_operand")
(minus:DI
(match_operand:DI 2 "const_int_operand")
- (sign_extend:DI
+ (any_extend:DI
(xor:SI
(minus:SI (const_int 31)
(clz:SI (match_operand:SI 1 "nonimmediate_operand")))