1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: {{^}}cube: 4*9880d681SAndroid Build Coastguard Worker; CHECK: CUBE T{{[0-9]}}.X 5*9880d681SAndroid Build Coastguard Worker; CHECK: CUBE T{{[0-9]}}.Y 6*9880d681SAndroid Build Coastguard Worker; CHECK: CUBE T{{[0-9]}}.Z 7*9880d681SAndroid Build Coastguard Worker; CHECK: CUBE * T{{[0-9]}}.W 8*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @cube() { 9*9880d681SAndroid Build Coastguard Workermain_body: 10*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker %tmp1 = extractelement <4 x float> %tmp, i32 3 12*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker %tmp3 = extractelement <4 x float> %tmp2, i32 0 14*9880d681SAndroid Build Coastguard Worker %tmp4 = fdiv float %tmp3, %tmp1 15*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker %tmp6 = extractelement <4 x float> %tmp5, i32 1 17*9880d681SAndroid Build Coastguard Worker %tmp7 = fdiv float %tmp6, %tmp1 18*9880d681SAndroid Build Coastguard Worker %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*9880d681SAndroid Build Coastguard Worker %tmp9 = extractelement <4 x float> %tmp8, i32 2 20*9880d681SAndroid Build Coastguard Worker %tmp10 = fdiv float %tmp9, %tmp1 21*9880d681SAndroid Build Coastguard Worker %tmp11 = insertelement <4 x float> undef, float %tmp4, i32 0 22*9880d681SAndroid Build Coastguard Worker %tmp12 = insertelement <4 x float> %tmp11, float %tmp7, i32 1 23*9880d681SAndroid Build Coastguard Worker %tmp13 = insertelement <4 x float> %tmp12, float %tmp10, i32 2 24*9880d681SAndroid Build Coastguard Worker %tmp14 = insertelement <4 x float> %tmp13, float 1.000000e+00, i32 3 25*9880d681SAndroid Build Coastguard Worker %tmp15 = call <4 x float> @llvm.AMDGPU.cube(<4 x float> %tmp14) 26*9880d681SAndroid Build Coastguard Worker %tmp16 = extractelement <4 x float> %tmp15, i32 0 27*9880d681SAndroid Build Coastguard Worker %tmp17 = extractelement <4 x float> %tmp15, i32 1 28*9880d681SAndroid Build Coastguard Worker %tmp18 = extractelement <4 x float> %tmp15, i32 2 29*9880d681SAndroid Build Coastguard Worker %tmp19 = extractelement <4 x float> %tmp15, i32 3 30*9880d681SAndroid Build Coastguard Worker %tmp20 = call float @llvm.fabs.f32(float %tmp18) 31*9880d681SAndroid Build Coastguard Worker %tmp21 = fdiv float 1.000000e+00, %tmp20 32*9880d681SAndroid Build Coastguard Worker %tmp22 = fmul float %tmp16, %tmp21 33*9880d681SAndroid Build Coastguard Worker %tmp23 = fadd float %tmp22, 1.500000e+00 34*9880d681SAndroid Build Coastguard Worker %tmp24 = fmul float %tmp17, %tmp21 35*9880d681SAndroid Build Coastguard Worker %tmp25 = fadd float %tmp24, 1.500000e+00 36*9880d681SAndroid Build Coastguard Worker %tmp26 = insertelement <4 x float> undef, float %tmp25, i32 0 37*9880d681SAndroid Build Coastguard Worker %tmp27 = insertelement <4 x float> %tmp26, float %tmp23, i32 1 38*9880d681SAndroid Build Coastguard Worker %tmp28 = insertelement <4 x float> %tmp27, float %tmp19, i32 2 39*9880d681SAndroid Build Coastguard Worker %tmp29 = insertelement <4 x float> %tmp28, float %tmp25, i32 3 40*9880d681SAndroid Build Coastguard Worker %tmp30 = shufflevector <4 x float> %tmp29, <4 x float> %tmp29, <4 x i32> <i32 0, i32 1, i32 2, i32 3> 41*9880d681SAndroid Build Coastguard Worker %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) 42*9880d681SAndroid Build Coastguard Worker call void @llvm.R600.store.swizzle(<4 x float> %tmp31, i32 0, i32 0) 43*9880d681SAndroid Build Coastguard Worker ret void 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker; Function Attrs: readnone 47*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.AMDGPU.cube(<4 x float>) #0 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 50*9880d681SAndroid Build Coastguard Workerdeclare float @llvm.fabs.f32(float) #0 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.R600.store.swizzle(<4 x float>, i32, i32) 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker; Function Attrs: readnone 55*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.r600.tex(<4 x float>, i32, i32, i32, i32, i32, i32, i32, i32, i32) #0 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone } 58