On Mon, Sep 19, 2011 at 9:08 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> AVX2 prefers v*i128 instructions for vector integer > modes, while AVX only supports v*f128. > In one of my recent patches I've changed vextract* so that > it emits v*i128 instead of v*f128 for AVX2 on integer modes, > but I wonder what is the prefered way to change the rest > of the insn. > > E.g. we have: > (define_insn "avx_vbroadcastf128_<mode>" > [(set (match_operand:V_256 0 "register_operand" "=x,x,x") > (vec_concat:V_256 > (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x") > (match_dup 1)))] > "TARGET_AVX" > "@ > vbroadcastf128\t{%1, %0|%0, %1} > vinsertf128\t{$1, %1, %0, %0|%0, %0, %1, 1} > vperm2f128\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}" > [(set_attr "type" "ssemov,sselog1,sselog1") > (set_attr "prefix_extra" "1") > (set_attr "length_immediate" "0,1,1") > (set_attr "prefix" "vex") > (set_attr "mode" "V4SF,V8SF,V8SF")]) > > One option is change the mode iterator, so that it > iterates on all 256-bit vectors for !TARGET_AVX2, and only > for V8SF and V4DF for TARGET_AVX2, then for each such an insn also > add similar insn that iterates on the 256-bit integer vectors, > is guarded by TARGET_AVX2 and uses *i128 and OI mode attribute instead of > V8SF or V4DF. > > Or, e.g. we could have operand modifier that would print "i128" > resp. "i" for TARGET_AVX2 and integer vector modes, and would print > "f128" resp. "f" otherwise. Still, something would need to be done > about the mode attribute. > > Or something else? Perhaps use mode attribute that defines "f" for FP modes and "%i" for integer modes. "%i" is further processed in ix86_output_operand (or perhaps ASM_OUTPUT_OPCODE, similar to %v ?) to output "i" for TARGET_AVX2 or "f" otherwise. Uros.