https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117116
--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Hongtao Liu from comment #4) > (In reply to Hongtao Liu from comment #3) > > A simple testcase > > > > typedef long long v4di __attribute__((vector_size(32))); > > > > v4di > > foo (long long a) > > { > > return __extension__(v4di){(long long)foo, 1, 1, 1}; > > } > > > > reproduced with -O2 -mavx2, failed at least since gcc4.8.1 > > 19843;; sse4_1_pinsrd must come before sse2_loadld since it is preferred. > > 19844(define_insn "<sse2p4_1>_pinsr<ssemodesuffix>" [...] > Doesn't support V2DI, we're using. It's not a problem with the above pattern, which *does* support V2DI: ;; Modes handled by pinsr patterns. (define_mode_iterator PINSR_MODE [(V16QI "TARGET_SSE4_1") V8HI V8HF V8BF (V4SI "TARGET_SSE4_1") (V2DI "TARGET_SSE4_1 && TARGET_64BIT")]) but with operand 2 that doesn't satisfy DImode nonimmediate_operand predicate in: ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred. (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>" [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v,&x") (vec_merge:PINSR_MODE (vec_duplicate:PINSR_MODE (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "jr,jm,r,m,r,m,x")) (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v,x") (match_operand:SI 3 "const_int_operand")))] "TARGET_SSE2 && ((unsigned) exact_log2 (INTVAL (operands[3])) < GET_MODE_NUNITS (<MODE>mode))" (insn 8 7 9 2 (set (reg:V2DI 103) (vec_merge:V2DI (vec_duplicate:V2DI (symbol_ref:DI ("foo") [flags 0x3] <function_decl 0x7f412dfec200 foo>)) (reg:V2DI 103) (const_int 1 [0x1]))) "pr117116.c":6:12 -1 (nil)) Please note that: (symbol_ref:DI ("foo") [flags 0x3] <function_decl 0x7f412dfec200 foo>) does *not* represent a memory operand. A mem(...) is missing around. So, the problem is, where immediate operand leaks into RTX.