Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 2 | ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s |
| 3 | |
Matt Arsenault | 9babdf4 | 2016-06-22 20:15:28 +0000 | [diff] [blame] | 4 | ; This should end with an no-op sequence of exec mask manipulations |
| 5 | ; Mask should be in original state after executed unreachable block |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 6 | |
| 7 | ; GCN-LABEL: {{^}}main: |
Matt Arsenault | 327188a | 2016-12-15 21:57:11 +0000 | [diff] [blame] | 8 | ; GCN: s_cbranch_scc1 [[RET_BB:BB[0-9]+_[0-9]+]] |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 9 | |
Matt Arsenault | 9babdf4 | 2016-06-22 20:15:28 +0000 | [diff] [blame] | 10 | ; GCN: s_and_saveexec_b64 [[SAVE_EXEC:s\[[0-9]+:[0-9]+\]]], vcc |
| 11 | ; GCN-NEXT: s_xor_b64 [[XOR_EXEC:s\[[0-9]+:[0-9]+\]]], exec, [[SAVE_EXEC]] |
| 12 | ; GCN-NEXT: ; mask branch [[UNREACHABLE_BB:BB[0-9]+_[0-9]+]] |
| 13 | |
| 14 | ; GCN: [[RET_BB]]: |
Nicolai Haehnle | e40530e | 2016-07-06 08:35:17 +0000 | [diff] [blame] | 15 | ; GCN-NEXT: s_branch [[FINAL_BB:BB[0-9]+_[0-9]+]] |
Matt Arsenault | 9babdf4 | 2016-06-22 20:15:28 +0000 | [diff] [blame] | 16 | |
| 17 | ; GCN-NEXT: [[UNREACHABLE_BB]]: |
| 18 | ; GCN-NEXT: s_or_b64 exec, exec, [[XOR_EXEC]] |
Nicolai Haehnle | e40530e | 2016-07-06 08:35:17 +0000 | [diff] [blame] | 19 | ; GCN-NEXT: [[FINAL_BB]]: |
Matt Arsenault | 9babdf4 | 2016-06-22 20:15:28 +0000 | [diff] [blame] | 20 | ; GCN-NEXT: .Lfunc_end0 |
Matt Arsenault | d2c8a33 | 2017-02-16 02:01:13 +0000 | [diff] [blame] | 21 | define amdgpu_ps <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> @main([9 x <16 x i8>] addrspace(2)* byval %arg, [17 x <16 x i8>] addrspace(2)* byval %arg1, [17 x <8 x i32>] addrspace(2)* byval %arg2, i32 addrspace(2)* byval %arg3, float inreg %arg4, i32 inreg %arg5, <2 x i32> %arg6, <2 x i32> %arg7, <2 x i32> %arg8, <3 x i32> %arg9, <2 x i32> %arg10, <2 x i32> %arg11, <2 x i32> %arg12, float %arg13, float %arg14, float %arg15, float %arg16, float %arg17, i32 %arg18, i32 %arg19, float %arg20, i32 %arg21) #0 { |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 22 | main_body: |
Matt Arsenault | d2c8a33 | 2017-02-16 02:01:13 +0000 | [diff] [blame] | 23 | %i.i = extractelement <2 x i32> %arg7, i32 0 |
| 24 | %j.i = extractelement <2 x i32> %arg7, i32 1 |
| 25 | %i.f.i = bitcast i32 %i.i to float |
| 26 | %j.f.i = bitcast i32 %j.i to float |
| 27 | %p1.i = call float @llvm.amdgcn.interp.p1(float %i.f.i, i32 1, i32 0, i32 %arg5) #2 |
| 28 | %p2.i = call float @llvm.amdgcn.interp.p2(float %p1.i, float %j.f.i, i32 1, i32 0, i32 %arg5) #2 |
| 29 | %p87 = fmul float undef, %p2.i |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 30 | %p88 = fadd float %p87, undef |
| 31 | %p93 = fadd float %p88, undef |
| 32 | %p97 = fmul float %p93, undef |
| 33 | %p102 = fsub float %p97, undef |
| 34 | %p104 = fmul float %p102, undef |
| 35 | %p106 = fadd float 0.000000e+00, %p104 |
| 36 | %p108 = fadd float undef, %p106 |
| 37 | br i1 undef, label %ENDIF69, label %ELSE |
| 38 | |
| 39 | ELSE: ; preds = %main_body |
| 40 | %p124 = fmul float %p108, %p108 |
| 41 | %p125 = fsub float %p124, undef |
| 42 | %p126 = fcmp olt float %p125, 0.000000e+00 |
| 43 | br i1 %p126, label %ENDIF69, label %ELSE41 |
| 44 | |
| 45 | ELSE41: ; preds = %ELSE |
| 46 | unreachable |
| 47 | |
| 48 | ENDIF69: ; preds = %ELSE, %main_body |
| 49 | ret <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float }> undef |
| 50 | } |
| 51 | |
| 52 | ; Function Attrs: nounwind readnone |
Matt Arsenault | d2c8a33 | 2017-02-16 02:01:13 +0000 | [diff] [blame] | 53 | declare float @llvm.amdgcn.interp.p1(float, i32, i32, i32) #1 |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 54 | |
| 55 | ; Function Attrs: nounwind readnone |
Matt Arsenault | d2c8a33 | 2017-02-16 02:01:13 +0000 | [diff] [blame] | 56 | declare float @llvm.amdgcn.interp.p2(float, float, i32, i32, i32) #1 |
| 57 | |
| 58 | ; Function Attrs: nounwind readnone |
| 59 | declare float @llvm.amdgcn.interp.mov(i32, i32, i32, i32) #1 |
| 60 | |
| 61 | ; Function Attrs: nounwind readnone |
| 62 | declare float @llvm.SI.load.const(<16 x i8>, i32) #1 |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 63 | |
| 64 | ; Function Attrs: nounwind readnone |
| 65 | declare float @llvm.fabs.f32(float) #1 |
| 66 | |
| 67 | ; Function Attrs: nounwind readnone |
| 68 | declare float @llvm.sqrt.f32(float) #1 |
| 69 | |
| 70 | ; Function Attrs: nounwind readnone |
| 71 | declare float @llvm.floor.f32(float) #1 |
| 72 | |
Nicolai Haehnle | df3a20c | 2016-04-06 19:40:20 +0000 | [diff] [blame] | 73 | attributes #0 = { "InitialPSInputAddr"="36983" } |
Marek Olsak | ed2213e | 2016-03-14 15:57:14 +0000 | [diff] [blame] | 74 | attributes #1 = { nounwind readnone } |
Matt Arsenault | d2c8a33 | 2017-02-16 02:01:13 +0000 | [diff] [blame] | 75 | attributes #2 = { nounwind } |