| 2005-05-10 Jakub Jelinek <jakub@redhat.com> |
| |
| * config/i386/i386.md (movsi_insv_1, movdi_insv_1_rex64): Mask |
| CONST_INT values with 255. |
| |
| * gcc.dg/20050510-2.c: New test. |
| |
| |
| |
| @@ -1771,7 +1771,11 @@ |
| (const_int 8)) |
| (match_operand:SI 1 "general_operand" "Qmn"))] |
| "!TARGET_64BIT" |
| - "mov{b}\t{%b1, %h0|%h0, %b1}" |
| +{ |
| + if (GET_CODE (operands[1]) == CONST_INT) |
| + operands[1] = GEN_INT (INTVAL (operands[1]) & 255); |
| + return "mov{b}\t{%b1, %h0|%h0, %b1}"; |
| +} |
| [(set_attr "type" "imov") |
| (set_attr "mode" "QI")]) |
| |
| @@ -1781,7 +1785,11 @@ |
| (const_int 8)) |
| (match_operand:DI 1 "nonmemory_operand" "Qn"))] |
| "TARGET_64BIT" |
| - "mov{b}\t{%b1, %h0|%h0, %b1}" |
| +{ |
| + if (GET_CODE (operands[1]) == CONST_INT) |
| + operands[1] = GEN_INT (INTVAL (operands[1]) & 255); |
| + return "mov{b}\t{%b1, %h0|%h0, %b1}"; |
| +} |
| [(set_attr "type" "imov") |
| (set_attr "mode" "QI")]) |
| |
| |
| |
| @@ -0,0 +1,26 @@ |
| +/* { dg-options run } */ |
| +/* { dg-options "-O2" } */ |
| + |
| +extern void abort (void); |
| + |
| +__attribute__((noinline)) int |
| +foo (unsigned char *x) |
| +{ |
| + if (x[0] != 1 || x[1] != 0x15) |
| + abort (); |
| + return 0; |
| +} |
| + |
| +static inline void |
| +bar (unsigned short x) |
| +{ |
| + unsigned char s[2] = { x >> 8, x & 0xff }; |
| + foo (s); |
| +} |
| + |
| +int |
| +main (void) |
| +{ |
| + bar (0x115); |
| + return 0; |
| +} |