Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=r600 -mcpu=cayman -stress-sched -verify-misched -verify-machineinstrs < %s |
| 2 | ; REQUIRES: asserts |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 3 | |
Matt Arsenault | 3dbeefa | 2017-03-21 21:39:51 +0000 | [diff] [blame] | 4 | define amdgpu_kernel void @main() #0 { |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 5 | main_body: |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 6 | %tmp = load <4 x float>, <4 x float> addrspace(9)* null |
| 7 | %tmp5 = extractelement <4 x float> %tmp, i32 3 |
| 8 | %tmp6 = fptosi float %tmp5 to i32 |
| 9 | %tmp7 = bitcast i32 %tmp6 to float |
| 10 | %tmp8 = bitcast float %tmp7 to i32 |
| 11 | %tmp9 = sdiv i32 %tmp8, 4 |
| 12 | %tmp10 = bitcast i32 %tmp9 to float |
| 13 | %tmp11 = bitcast float %tmp10 to i32 |
| 14 | %tmp12 = mul i32 %tmp11, 4 |
| 15 | %tmp13 = bitcast i32 %tmp12 to float |
| 16 | %tmp14 = bitcast float %tmp13 to i32 |
| 17 | %tmp15 = sub i32 0, %tmp14 |
| 18 | %tmp16 = bitcast i32 %tmp15 to float |
| 19 | %tmp17 = bitcast float %tmp7 to i32 |
| 20 | %tmp18 = bitcast float %tmp16 to i32 |
| 21 | %tmp19 = add i32 %tmp17, %tmp18 |
| 22 | %tmp20 = bitcast i32 %tmp19 to float |
| 23 | %tmp21 = load <4 x float>, <4 x float> addrspace(9)* null |
| 24 | %tmp22 = extractelement <4 x float> %tmp21, i32 0 |
| 25 | %tmp23 = load <4 x float>, <4 x float> addrspace(9)* null |
| 26 | %tmp24 = extractelement <4 x float> %tmp23, i32 1 |
| 27 | %tmp25 = load <4 x float>, <4 x float> addrspace(9)* null |
| 28 | %tmp26 = extractelement <4 x float> %tmp25, i32 2 |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 29 | br label %LOOP |
| 30 | |
| 31 | LOOP: ; preds = %IF31, %main_body |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 32 | %temp12.0 = phi float [ 0.000000e+00, %main_body ], [ %tmp47, %IF31 ] |
| 33 | %temp6.0 = phi float [ %tmp26, %main_body ], [ %temp6.1, %IF31 ] |
| 34 | %temp5.0 = phi float [ %tmp24, %main_body ], [ %temp5.1, %IF31 ] |
| 35 | %temp4.0 = phi float [ %tmp22, %main_body ], [ %temp4.1, %IF31 ] |
| 36 | %tmp27 = bitcast float %temp12.0 to i32 |
| 37 | %tmp28 = bitcast float %tmp10 to i32 |
| 38 | %tmp29 = icmp sge i32 %tmp27, %tmp28 |
| 39 | %tmp30 = sext i1 %tmp29 to i32 |
| 40 | %tmp31 = bitcast i32 %tmp30 to float |
| 41 | %tmp32 = bitcast float %tmp31 to i32 |
| 42 | %tmp33 = icmp ne i32 %tmp32, 0 |
| 43 | br i1 %tmp33, label %IF, label %LOOP29 |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 44 | |
| 45 | IF: ; preds = %LOOP |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 46 | %max.0.i = call float @llvm.maxnum.f32(float %temp4.0, float 0.000000e+00) |
| 47 | %clamp.i = call float @llvm.minnum.f32(float %max.0.i, float 1.000000e+00) |
| 48 | %max.0.i3 = call float @llvm.maxnum.f32(float %temp5.0, float 0.000000e+00) |
| 49 | %clamp.i4 = call float @llvm.minnum.f32(float %max.0.i3, float 1.000000e+00) |
| 50 | %max.0.i1 = call float @llvm.maxnum.f32(float %temp6.0, float 0.000000e+00) |
| 51 | %clamp.i2 = call float @llvm.minnum.f32(float %max.0.i1, float 1.000000e+00) |
| 52 | %tmp34 = insertelement <4 x float> undef, float %clamp.i, i32 0 |
| 53 | %tmp35 = insertelement <4 x float> %tmp34, float %clamp.i4, i32 1 |
| 54 | %tmp36 = insertelement <4 x float> %tmp35, float %clamp.i2, i32 2 |
| 55 | %tmp37 = insertelement <4 x float> %tmp36, float 1.000000e+00, i32 3 |
| 56 | call void @llvm.r600.store.swizzle(<4 x float> %tmp37, i32 0, i32 0) |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 57 | ret void |
| 58 | |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 59 | LOOP29: ; preds = %ENDIF30, %LOOP |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 60 | %temp6.1 = phi float [ %temp4.1, %ENDIF30 ], [ %temp6.0, %LOOP ] |
| 61 | %temp5.1 = phi float [ %temp6.1, %ENDIF30 ], [ %temp5.0, %LOOP ] |
| 62 | %temp4.1 = phi float [ %temp5.1, %ENDIF30 ], [ %temp4.0, %LOOP ] |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 63 | %temp20.0 = phi float [ %tmp50, %ENDIF30 ], [ 0.000000e+00, %LOOP ] |
| 64 | %tmp38 = bitcast float %temp20.0 to i32 |
| 65 | %tmp39 = bitcast float %tmp20 to i32 |
| 66 | %tmp40 = icmp sge i32 %tmp38, %tmp39 |
| 67 | %tmp41 = sext i1 %tmp40 to i32 |
| 68 | %tmp42 = bitcast i32 %tmp41 to float |
| 69 | %tmp43 = bitcast float %tmp42 to i32 |
| 70 | %tmp44 = icmp ne i32 %tmp43, 0 |
| 71 | br i1 %tmp44, label %IF31, label %ENDIF30 |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 72 | |
| 73 | IF31: ; preds = %LOOP29 |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 74 | %tmp45 = bitcast float %temp12.0 to i32 |
| 75 | %tmp46 = add i32 %tmp45, 1 |
| 76 | %tmp47 = bitcast i32 %tmp46 to float |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 77 | br label %LOOP |
| 78 | |
| 79 | ENDIF30: ; preds = %LOOP29 |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 80 | %tmp48 = bitcast float %temp20.0 to i32 |
| 81 | %tmp49 = add i32 %tmp48, 1 |
| 82 | %tmp50 = bitcast i32 %tmp49 to float |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 83 | br label %LOOP29 |
| 84 | } |
| 85 | |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 86 | declare void @llvm.r600.store.swizzle(<4 x float>, i32, i32) #0 |
| 87 | declare float @llvm.minnum.f32(float, float) #1 |
| 88 | declare float @llvm.maxnum.f32(float, float) #1 |
Vincent Lejeune | e5ecf10 | 2013-03-11 18:15:06 +0000 | [diff] [blame] | 89 | |
Matt Arsenault | 9417505 | 2017-02-21 23:46:04 +0000 | [diff] [blame] | 90 | attributes #0 = { nounwind } |
| 91 | attributes #1 = { nounwind readnone } |