[PATCH] D38316: [InstCombine] replace bitcast to scalar + insertelement with widening shuffle + vector bitcast

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 12:43:32 PDT 2017


efriedma added a comment.

I meant, "how do we fix x86 in the general case"? Consider the following (with -mtriple=x86_64 -mattr=+xop):

  define <8 x i64> @test(i32 %x0, i32 %x1, <8 x i64> %v) {
    %1 = insertelement <2 x i32> undef, i32 %x0, i32 0
    %2 = insertelement <2 x i32> %1, i32 %x1, i32 1
    %3 = bitcast <2 x i32> %2 to i64
    %4 = insertelement <8 x i64> %v, i64 %3, i32 0
    ret <8 x i64> %4
  }

We currently generate a five-instruction sequence for something which can be done in two instructions.  And the instcombine here won't trigger.


https://reviews.llvm.org/D38316





More information about the llvm-commits mailing list