(define_insn "*extv<mode>"
[(set (match_operand:SWI24 0 "register_operand" "=R")
- (sign_extract:SWI24 (match_operand:SWI24 1 "register_operand" "Q")
+ (sign_extract:SWI24 (match_operand 1 "extr_register_operand" "Q")
(const_int 8)
(const_int 8)))]
""
(define_insn "*extzv<mode>"
[(set (match_operand:SWI248 0 "register_operand" "=R")
- (zero_extract:SWI248 (match_operand:SWI248 1 "register_operand" "Q")
+ (zero_extract:SWI248 (match_operand 1 "extr_register_operand" "Q")
(const_int 8)
(const_int 8)))]
""
(if_then_else (eq_attr "prefix_0f" "0")
(const_string "0")
(const_string "1")))])
+
+(define_insn "*extendqi<SWI24:mode>_ext_1"
+ [(set (match_operand:SWI24 0 "register_operand" "=R")
+ (sign_extend:SWI24
+ (subreg:QI
+ (zero_extract:SWI248
+ (match_operand:SWI248 1 "register_operand" "Q")
+ (const_int 8)
+ (const_int 8)) 0)))]
+ ""
+ "movs{b<SWI24:imodesuffix>|x}\t{%h1, %0|%0, %h1}"
+ [(set_attr "type" "imovx")
+ (set_attr "mode" "<SWI24:MODE>")])
\f
;; Conversions between float and double.
(and (match_code "reg")
(match_test "MASK_REGNO_P (REGNO (op))")))
+;; Match a DI, SI or HImode register operand for extract op.
+(define_special_predicate "extr_register_operand"
+ (and (match_operand 0 "register_operand")
+ (ior (and (match_test "TARGET_64BIT")
+ (match_test "GET_MODE (op) == DImode"))
+ (match_test "GET_MODE (op) == SImode")
+ (match_test "GET_MODE (op) == HImode"))))
+
;; Match a DI, SI, HI or QImode nonimmediate_operand.
(define_special_predicate "int_nonimmediate_operand"
(and (match_operand 0 "nonimmediate_operand")
--- /dev/null
+/* PR target/108516 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -dp" } */
+/* { dg-additional-options "-mregparm=1" { target ia32 } } */
+
+struct S
+{
+ unsigned char e1;
+ unsigned char e2;
+ unsigned char e3;
+};
+
+unsigned int
+f2 (struct S s)
+{
+ return s.e2;
+}
+
+/* { dg-final { scan-assembler-not "\\*zero_extend" } } */
--- /dev/null
+/* PR target/108516 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -dp" } */
+/* { dg-additional-options "-mregparm=1" { target ia32 } } */
+
+struct S
+{
+ signed char e1;
+ signed char e2;
+ signed char e3;
+};
+
+int
+f2 (struct S s)
+{
+ return s.e2;
+}
+
+/* { dg-final { scan-assembler-not "\\*extzv" } } */