2013-06-26 05:22:18 +08:00
|
|
|
; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
|
|
|
|
|
2016-01-26 12:29:56 +08:00
|
|
|
; CHECK-LABEL: {{^}}cube:
|
2013-06-26 05:22:18 +08:00
|
|
|
; CHECK: CUBE T{{[0-9]}}.X
|
|
|
|
; CHECK: CUBE T{{[0-9]}}.Y
|
|
|
|
; CHECK: CUBE T{{[0-9]}}.Z
|
|
|
|
; CHECK: CUBE * T{{[0-9]}}.W
|
2016-04-07 03:40:20 +08:00
|
|
|
define amdgpu_ps void @cube() {
|
2013-06-26 05:22:18 +08:00
|
|
|
main_body:
|
2015-03-14 02:20:45 +08:00
|
|
|
%0 = 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)
|
2013-06-26 05:22:18 +08:00
|
|
|
%1 = extractelement <4 x float> %0, i32 3
|
2015-03-14 02:20:45 +08:00
|
|
|
%2 = 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)
|
2013-06-26 05:22:18 +08:00
|
|
|
%3 = extractelement <4 x float> %2, i32 0
|
|
|
|
%4 = fdiv float %3, %1
|
2015-03-14 02:20:45 +08:00
|
|
|
%5 = 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)
|
2013-06-26 05:22:18 +08:00
|
|
|
%6 = extractelement <4 x float> %5, i32 1
|
|
|
|
%7 = fdiv float %6, %1
|
2015-03-14 02:20:45 +08:00
|
|
|
%8 = 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)
|
2013-06-26 05:22:18 +08:00
|
|
|
%9 = extractelement <4 x float> %8, i32 2
|
|
|
|
%10 = fdiv float %9, %1
|
|
|
|
%11 = insertelement <4 x float> undef, float %4, i32 0
|
|
|
|
%12 = insertelement <4 x float> %11, float %7, i32 1
|
|
|
|
%13 = insertelement <4 x float> %12, float %10, i32 2
|
|
|
|
%14 = insertelement <4 x float> %13, float 1.000000e+00, i32 3
|
|
|
|
%15 = call <4 x float> @llvm.AMDGPU.cube(<4 x float> %14)
|
|
|
|
%16 = extractelement <4 x float> %15, i32 0
|
|
|
|
%17 = extractelement <4 x float> %15, i32 1
|
|
|
|
%18 = extractelement <4 x float> %15, i32 2
|
|
|
|
%19 = extractelement <4 x float> %15, i32 3
|
|
|
|
%20 = call float @fabs(float %18)
|
|
|
|
%21 = fdiv float 1.000000e+00, %20
|
|
|
|
%22 = fmul float %16, %21
|
|
|
|
%23 = fadd float %22, 1.500000e+00
|
|
|
|
%24 = fmul float %17, %21
|
|
|
|
%25 = fadd float %24, 1.500000e+00
|
|
|
|
%26 = insertelement <4 x float> undef, float %25, i32 0
|
|
|
|
%27 = insertelement <4 x float> %26, float %23, i32 1
|
|
|
|
%28 = insertelement <4 x float> %27, float %19, i32 2
|
|
|
|
%29 = insertelement <4 x float> %28, float %25, i32 3
|
|
|
|
%30 = call <4 x float> @llvm.AMDGPU.tex(<4 x float> %29, i32 16, i32 0, i32 4)
|
|
|
|
call void @llvm.R600.store.swizzle(<4 x float> %30, i32 0, i32 0)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: readnone
|
2016-04-07 03:40:20 +08:00
|
|
|
declare <4 x float> @llvm.AMDGPU.cube(<4 x float>) #0
|
2013-06-26 05:22:18 +08:00
|
|
|
|
|
|
|
; Function Attrs: readnone
|
2016-04-07 03:40:20 +08:00
|
|
|
declare float @fabs(float) #0
|
2013-06-26 05:22:18 +08:00
|
|
|
|
|
|
|
; Function Attrs: readnone
|
2016-04-07 03:40:20 +08:00
|
|
|
declare <4 x float> @llvm.AMDGPU.tex(<4 x float>, i32, i32, i32) #0
|
2013-06-26 05:22:18 +08:00
|
|
|
|
|
|
|
declare void @llvm.R600.store.swizzle(<4 x float>, i32, i32)
|
|
|
|
|
2016-04-07 03:40:20 +08:00
|
|
|
attributes #0 = { readnone }
|
2013-06-26 05:22:18 +08:00
|
|
|
|