xref: /llvm-project/llvm/test/CodeGen/X86/commuted-blend-mask.ll (revision 940eae3cc1f05a0e7e0e9b712f676d01ad92132c)
1; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s
3
4; When commuting the operands of a SSE blend, make sure that the resulting blend
5; mask can be encoded as a imm8.
6; Before, when commuting the operands to the shuffle in function @test, the backend
7; produced the following assembly:
8;   pblendw $4294967103, %xmm1, %xmm0
9
10define <4 x i32> @test(<4 x i32> %a, <4 x i32> %b) {
11; CHECK: pblendw $63, %xmm1, %xmm0
12  %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 6, i32 3>
13  ; add forces execution domain
14  %sum = add <4 x i32> %shuffle, %shuffle
15  ret <4 x i32> %sum
16}
17