Hi, We should only expand strlen to Pmode. Otherwise, we got
[hjl@gnu-6 ilp32-38]$ cat x.i char one[50] = "ijk"; int main (void) { return __builtin_strlen (one) != 3; } [hjl@gnu-6 ilp32-38]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -S -o x.s -mx32 -O2 x.i x.i: In function ‘main’: x.i:5:27: internal compiler error: in emit_move_insn, at expr.c:3333 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. OK for trunk? Thanks. H.J. ---- 2011-07-27 H.J. Lu <hongjiu...@intel.com> PR target/47364 * config/i386/i386.md (strlen<mode>): Replace SWI48x with P. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index e91a299..c772f94 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -15824,11 +15855,11 @@ (set_attr "prefix_rep" "1")]) (define_expand "strlen<mode>" - [(set (match_operand:SWI48x 0 "register_operand" "") - (unspec:SWI48x [(match_operand:BLK 1 "general_operand" "") - (match_operand:QI 2 "immediate_operand" "") - (match_operand 3 "immediate_operand" "")] - UNSPEC_SCAS))] + [(set (match_operand:P 0 "register_operand" "") + (unspec:P [(match_operand:BLK 1 "general_operand" "") + (match_operand:QI 2 "immediate_operand" "") + (match_operand 3 "immediate_operand" "")] + UNSPEC_SCAS))] "" { if (ix86_expand_strlen (operands[0], operands[1], operands[2], operands[3]))