blob: b5a0de95acf50daacbb516372c7280256c32965b [file] [log] [blame]
Matt Arsenaultca7f5702016-07-14 05:47:17 +00001; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s
Tom Stellard02661d92013-06-25 21:22:18 +00002
Matt Arsenault051d6f92016-01-26 04:29:56 +00003; CHECK-LABEL: {{^}}cube:
Tom Stellard02661d92013-06-25 21:22:18 +00004; CHECK: CUBE T{{[0-9]}}.X
5; CHECK: CUBE T{{[0-9]}}.Y
6; CHECK: CUBE T{{[0-9]}}.Z
7; CHECK: CUBE * T{{[0-9]}}.W
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +00008define amdgpu_ps void @cube() {
Tom Stellard02661d92013-06-25 21:22:18 +00009main_body:
Matt Arsenaultca7f5702016-07-14 05:47:17 +000010 %tmp = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
11 %tmp1 = extractelement <4 x float> %tmp, i32 3
12 %tmp2 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
13 %tmp3 = extractelement <4 x float> %tmp2, i32 0
14 %tmp4 = fdiv float %tmp3, %tmp1
15 %tmp5 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
16 %tmp6 = extractelement <4 x float> %tmp5, i32 1
17 %tmp7 = fdiv float %tmp6, %tmp1
18 %tmp8 = load <4 x float>, <4 x float> addrspace(8)* getelementptr ([1024 x <4 x float>], [1024 x <4 x float>] addrspace(8)* null, i64 0, i32 9)
19 %tmp9 = extractelement <4 x float> %tmp8, i32 2
20 %tmp10 = fdiv float %tmp9, %tmp1
21 %tmp11 = insertelement <4 x float> undef, float %tmp4, i32 0
22 %tmp12 = insertelement <4 x float> %tmp11, float %tmp7, i32 1
23 %tmp13 = insertelement <4 x float> %tmp12, float %tmp10, i32 2
24 %tmp14 = insertelement <4 x float> %tmp13, float 1.000000e+00, i32 3
Matt Arsenaultb95ddd72017-02-16 19:09:04 +000025 %tmp15 = call <4 x float> @llvm.r600.cube(<4 x float> %tmp14)
Matt Arsenaultca7f5702016-07-14 05:47:17 +000026 %tmp16 = extractelement <4 x float> %tmp15, i32 0
27 %tmp17 = extractelement <4 x float> %tmp15, i32 1
28 %tmp18 = extractelement <4 x float> %tmp15, i32 2
29 %tmp19 = extractelement <4 x float> %tmp15, i32 3
30 %tmp20 = call float @llvm.fabs.f32(float %tmp18)
31 %tmp21 = fdiv float 1.000000e+00, %tmp20
32 %tmp22 = fmul float %tmp16, %tmp21
33 %tmp23 = fadd float %tmp22, 1.500000e+00
34 %tmp24 = fmul float %tmp17, %tmp21
35 %tmp25 = fadd float %tmp24, 1.500000e+00
36 %tmp26 = insertelement <4 x float> undef, float %tmp25, i32 0
37 %tmp27 = insertelement <4 x float> %tmp26, float %tmp23, i32 1
38 %tmp28 = insertelement <4 x float> %tmp27, float %tmp19, i32 2
39 %tmp29 = insertelement <4 x float> %tmp28, float %tmp25, i32 3
40 %tmp30 = shufflevector <4 x float> %tmp29, <4 x float> %tmp29, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
41 %tmp31 = call <4 x float> @llvm.r600.tex(<4 x float> %tmp30, i32 0, i32 0, i32 0, i32 16, i32 0, i32 1, i32 1, i32 1, i32 1)
Matt Arsenault82e5e1e2016-07-15 21:27:08 +000042 call void @llvm.r600.store.swizzle(<4 x float> %tmp31, i32 0, i32 0)
Tom Stellard02661d92013-06-25 21:22:18 +000043 ret void
44}
45
46; Function Attrs: readnone
Matt Arsenaultb95ddd72017-02-16 19:09:04 +000047declare <4 x float> @llvm.r600.cube(<4 x float>) #0
Tom Stellard02661d92013-06-25 21:22:18 +000048
Matt Arsenaultca7f5702016-07-14 05:47:17 +000049; Function Attrs: nounwind readnone
50declare float @llvm.fabs.f32(float) #0
Tom Stellard02661d92013-06-25 21:22:18 +000051
Matt Arsenault82e5e1e2016-07-15 21:27:08 +000052declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32)
Tom Stellard02661d92013-06-25 21:22:18 +000053
Matt Arsenaultca7f5702016-07-14 05:47:17 +000054; Function Attrs: readnone
55declare <4 x float> @llvm.r600.tex(<4 x float>, i32, i32, i32, i32, i32, i32, i32, i32, i32) #0
Tom Stellard02661d92013-06-25 21:22:18 +000056
Matt Arsenaultca7f5702016-07-14 05:47:17 +000057attributes #0 = { nounwind readnone }