| 1 |
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s |
| 2 |
|
| 3 |
; TODO: This test currently fails with LLVM_ENABLE_EXPENSIVE_CHECKS enabled |
| 4 |
; XFAIL: expensive_checks |
| 5 |
|
| 6 |
; CHECK-DAG: OpName [[SHFv4:%.+]] "shuffle_v4" |
| 7 |
; CHECK-DAG: OpName [[INSv4:%.+]] "insert_v4" |
| 8 |
; CHECK-DAG: OpName [[EXTv4:%.+]] "extract_v4" |
| 9 |
; CHECK-DAG: OpName [[INSv4C:%.+]] "insert_v4C" |
| 10 |
; CHECK-DAG: OpName [[EXTv4C:%.+]] "extract_v4C" |
| 11 |
|
| 12 |
|
| 13 |
; CHECK: [[SHFv4]] = OpFunction |
| 14 |
; CHECK-NEXT: [[A:%.+]] = OpFunctionParameter |
| 15 |
; CHECK-NEXT: [[B:%.+]] = OpFunctionParameter |
| 16 |
; CHECK: OpLabel |
| 17 |
; CHECK: [[R:%.+]] = OpVectorShuffle {{%.+}} [[A]] [[B]] 0 4 3 6 |
| 18 |
; CHECK: OpReturnValue [[R]] |
| 19 |
; CHECK-NEXT: OpFunctionEnd |
| 20 |
define <4 x float> @shuffle_v4(<8 x float> %A, <8 x float> %B) { |
| 21 |
%r = shufflevector <8 x float> %A, <8 x float> %B, <4 x i32> <i32 0, i32 4, i32 3, i32 6> |
| 22 |
ret <4 x float> %r |
| 23 |
} |
| 24 |
|
| 25 |
; CHECK: [[INSv4]] = OpFunction |
| 26 |
; CHECK-NEXT: [[V:%.+]] = OpFunctionParameter |
| 27 |
; CHECK-NEXT: [[E:%.+]] = OpFunctionParameter |
| 28 |
; CHECK-NEXT: [[C:%.+]] = OpFunctionParameter |
| 29 |
; CHECK: OpLabel |
| 30 |
; CHECK: [[R:%.+]] = OpVectorInsertDynamic {{%.+}} [[V]] [[E]] [[C]] |
| 31 |
; CHECK: OpReturnValue [[R]] |
| 32 |
; CHECK-NEXT: OpFunctionEnd |
| 33 |
define <4 x float> @insert_v4(<4 x float> %V, float %E, i32 %C) { |
| 34 |
%r = insertelement <4 x float> %V, float %E, i32 %C |
| 35 |
ret <4 x float> %r |
| 36 |
} |
| 37 |
|
| 38 |
; CHECK: [[EXTv4]] = OpFunction |
| 39 |
; CHECK-NEXT: [[V:%.+]] = OpFunctionParameter |
| 40 |
; CHECK-NEXT: [[C:%.+]] = OpFunctionParameter |
| 41 |
; CHECK: OpLabel |
| 42 |
; CHECK: [[R:%.+]] = OpVectorExtractDynamic {{%.+}} [[V]] [[C]] |
| 43 |
; CHECK: OpReturnValue [[R]] |
| 44 |
; CHECK-NEXT: OpFunctionEnd |
| 45 |
define float @extract_v4(<4 x float> %V, i32 %C) { |
| 46 |
%r = extractelement <4 x float> %V, i32 %C |
| 47 |
ret float %r |
| 48 |
} |
| 49 |
|
| 50 |
; CHECK: [[INSv4C]] = OpFunction |
| 51 |
; CHECK-NEXT: [[V:%.+]] = OpFunctionParameter |
| 52 |
; CHECK-NEXT: [[E:%.+]] = OpFunctionParameter |
| 53 |
; CHECK: OpLabel |
| 54 |
; CHECK: [[R:%.+]] = OpCompositeInsert {{%.+}} [[E]] [[V]] 3 |
| 55 |
; CHECK: OpReturnValue [[R]] |
| 56 |
; CHECK-NEXT: OpFunctionEnd |
| 57 |
define <4 x float> @insert_v4C(<4 x float> %V, float %E) { |
| 58 |
%r = insertelement <4 x float> %V, float %E, i32 3 |
| 59 |
ret <4 x float> %r |
| 60 |
} |
| 61 |
|
| 62 |
; CHECK: [[EXTv4C]] = OpFunction |
| 63 |
; CHECK-NEXT: [[V:%.+]] = OpFunctionParameter |
| 64 |
; CHECK: OpLabel |
| 65 |
; CHECK: [[R:%.+]] = OpCompositeExtract {{%.+}} [[V]] 2 |
| 66 |
; CHECK: OpReturnValue [[R]] |
| 67 |
; CHECK-NEXT: OpFunctionEnd |
| 68 |
define float @extract_v4C(<4 x float> %V) { |
| 69 |
%r = extractelement <4 x float> %V, i32 2 |
| 70 |
ret float %r |
| 71 |
} |