diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md index 05a835256bb..9716a0b2f2c 100644 --- a/gcc/config/i386/sync.md +++ b/gcc/config/i386/sync.md @@ -726,7 +726,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; @@ -763,7 +763,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; @@ -801,7 +801,7 @@ rtx result = convert_modes (mode, QImode, tem, 1); if (operands[4] == const0_rtx) result = expand_simple_binop (mode, ASHIFT, result, - operands[2], operands[0], 0, OPTAB_DIRECT); + operands[2], operands[0], 0, OPTAB_WIDEN); if (result != operands[0]) emit_move_insn (operands[0], result); DONE; diff --git a/gcc/testsuite/gcc.target/i386/pr103205.c b/gcc/testsuite/gcc.target/i386/pr103205.c new file mode 100644 index 00000000000..eaeea82fee2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103205.c @@ -0,0 +1,11 @@ +/* PR target/103205 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mtune-ctrl=^himode_math" } */ + +unsigned short a; + +unsigned short +foo (void) +{ + return __sync_fetch_and_and (&a, ~1) & 1; +}