===================================================================
@@ -3393,10 +3393,10 @@
(define_insn "*zero_extendsidi2_rex64"
[(set (match_operand:DI 0 "nonimmediate_operand"
- "=r ,o,?*Ym,?*y,?*Yi,!*x")
+ "=r ,o,?*Ym,?*y,?*Yi,!*x")
(zero_extend:DI
(match_operand:SI 1 "x86_64_zext_general_operand"
- "rmZ,0,r ,m ,r ,m*x")))]
+ "rmWz,0,r ,m ,r ,m*x")))]
"TARGET_64BIT"
"@
mov{l}\t{%1, %k0|%k0, %1}
===================================================================
@@ -18,7 +18,7 @@
;; <http://www.gnu.org/licenses/>.
;;; Unused letters:
-;;; B H T W
+;;; B H T
;;; h k v
;; Integer register constraints.
@@ -199,6 +199,16 @@
instructions)."
(match_operand 0 "x86_64_immediate_operand"))
+;; We use W prefix to denote any number of
+;; constant-or-symbol-reference constraints
+
+(define_constraint "Wz"
+ "32-bit unsigned integer constant, or a symbolic reference known
+ to fit that range (for zero-extending conversion operations that
+ require non-VOIDmode immediate operands)."
+ (and (match_operand 0 "x86_64_zext_immediate_operand")
+ (match_test "GET_MODE (op) != VOIDmode")))
+
(define_constraint "Z"
"32-bit unsigned integer constant, or a symbolic reference known
to fit that range (for immediate operands in zero-extending x86-64
===================================================================
@@ -341,11 +341,13 @@
(match_operand 0 "general_operand")))
;; Return true if OP is general operand representable on x86_64
-;; as zero extended constant.
+;; as zero extended constant. This predicate is used in zero-extending
+;; conversion operations that require non-VOIDmode immediate operands.
(define_predicate "x86_64_zext_general_operand"
(if_then_else (match_test "TARGET_64BIT")
(ior (match_operand 0 "nonimmediate_operand")
- (match_operand 0 "x86_64_zext_immediate_operand"))
+ (and (match_operand 0 "x86_64_zext_immediate_operand")
+ (match_test "GET_MODE (op) != VOIDmode")))
(match_operand 0 "general_operand")))
;; Return true if OP is general operand representable on x86_64
===================================================================
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int a, b, d, e, f, i, j, k, l, m;
+unsigned c;
+int g[] = { }, h[0];
+
+int
+fn1 () {
+ return 0;
+}
+
+void
+fn2 () {
+ c = 0;
+ e = 0;
+ for (;; e = 0)
+ if (f > j) {
+ k = fn1 ();
+ l = (d || k) * b;
+ m = l * a;
+ h[0] = m <= i;
+ } else
+ i = g[c];
+}