blob: 3f80d5e41a3f0688695c4fba7ab50c8740992252 [file] [log] [blame]
Vincent Lejeunebb3f9312013-07-31 19:32:07 +00001;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2
Tom Stellard79243d92014-10-01 17:15:17 +00003; CHECK-LABEL: {{^}}main:
Vincent Lejeunebb3f9312013-07-31 19:32:07 +00004; CHECK: ADD *
5
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +00006define amdgpu_vs void @main(<4 x float> inreg %reg0, <4 x float> inreg %reg1, <4 x float> inreg %reg2) {
Vincent Lejeunebb3f9312013-07-31 19:32:07 +00007main_body:
Vincent Lejeunef143af32013-11-11 22:10:24 +00008 %0 = extractelement <4 x float> %reg1, i32 0
9 %1 = extractelement <4 x float> %reg1, i32 1
10 %2 = extractelement <4 x float> %reg1, i32 2
11 %3 = extractelement <4 x float> %reg1, i32 3
12 %4 = extractelement <4 x float> %reg2, i32 0
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000013 %5 = fadd float %0, 2.0
14 %6 = fadd float %1, 3.0
15 %7 = fadd float %2, 4.0
16 %8 = fadd float %3, 5.0
17 %9 = bitcast float %4 to i32
18 %10 = mul i32 %9, 6
19 %11 = bitcast i32 %10 to float
20 %12 = insertelement <4 x float> undef, float %5, i32 0
21 %13 = insertelement <4 x float> %12, float %6, i32 1
22 %14 = insertelement <4 x float> %13, float %7, i32 2
23 %15 = insertelement <4 x float> %14, float %8, i32 3
24 %16 = insertelement <4 x float> %15, float %11, i32 3
25
Matt Arsenaultca7f5702016-07-14 05:47:17 +000026 %17 = call float @llvm.r600.dot4(<4 x float> %15,<4 x float> %16)
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000027 %18 = insertelement <4 x float> undef, float %17, i32 0
Matt Arsenault82e5e1e2016-07-15 21:27:08 +000028 call void @llvm.r600.store.swizzle(<4 x float> %18, i32 0, i32 2)
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000029 ret void
30}
31
Tom Stellard79243d92014-10-01 17:15:17 +000032; CHECK-LABEL: {{^}}main2:
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000033; CHECK-NOT: ADD *
34
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +000035define amdgpu_vs void @main2(<4 x float> inreg %reg0, <4 x float> inreg %reg1, <4 x float> inreg %reg2) {
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000036main_body:
Vincent Lejeunef143af32013-11-11 22:10:24 +000037 %0 = extractelement <4 x float> %reg1, i32 0
38 %1 = extractelement <4 x float> %reg1, i32 1
39 %2 = extractelement <4 x float> %reg1, i32 2
40 %3 = extractelement <4 x float> %reg1, i32 3
41 %4 = extractelement <4 x float> %reg2, i32 0
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000042 %5 = fadd float %0, 2.0
43 %6 = fadd float %1, 3.0
44 %7 = fadd float %2, 4.0
45 %8 = fadd float %3, 2.0
46 %9 = bitcast float %4 to i32
47 %10 = mul i32 %9, 6
48 %11 = bitcast i32 %10 to float
49 %12 = insertelement <4 x float> undef, float %5, i32 0
50 %13 = insertelement <4 x float> %12, float %6, i32 1
51 %14 = insertelement <4 x float> %13, float %7, i32 2
52 %15 = insertelement <4 x float> %14, float %8, i32 3
53 %16 = insertelement <4 x float> %15, float %11, i32 3
54
Matt Arsenaultca7f5702016-07-14 05:47:17 +000055 %17 = call float @llvm.r600.dot4(<4 x float> %15,<4 x float> %16)
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000056 %18 = insertelement <4 x float> undef, float %17, i32 0
Matt Arsenault82e5e1e2016-07-15 21:27:08 +000057 call void @llvm.r600.store.swizzle(<4 x float> %18, i32 0, i32 2)
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000058 ret void
59}
60
61; Function Attrs: readnone
Matt Arsenaultca7f5702016-07-14 05:47:17 +000062declare float @llvm.r600.dot4(<4 x float>, <4 x float>) #1
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000063
Matt Arsenault82e5e1e2016-07-15 21:27:08 +000064declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000065
Vincent Lejeunebb3f9312013-07-31 19:32:07 +000066attributes #1 = { readnone }