Tom Stellard | 86d12eb | 2014-08-01 00:32:28 +0000 | [diff] [blame^] | 1 | ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s |
| 2 | ; XXX: This testis for a bug in the SIShrinkInstruction pass and it will be |
| 3 | ; relevant once we are selecting 64-bit instructions. We are |
| 4 | ; currently selecting mostly 32-bit instruction, so the |
| 5 | ; SIShrinkInstructions pass isn't doing much. |
| 6 | ; XFAIL: * |
| 7 | |
| 8 | ; Test that we correctly commute a sub instruction |
| 9 | ; FUNC-LABEL: @sub_rev |
| 10 | ; SI-NOT: V_SUB_I32_e32 v{{[0-9]+}}, s |
| 11 | ; SI: V_SUBREV_I32_e32 v{{[0-9]+}}, s |
| 12 | |
| 13 | ; ModuleID = 'vop-shrink.ll' |
| 14 | |
| 15 | define void @sub_rev(i32 addrspace(1)* %out, <4 x i32> %sgpr, i32 %cond) { |
| 16 | entry: |
| 17 | %vgpr = call i32 @llvm.r600.read.tidig.x() #1 |
| 18 | %tmp = icmp eq i32 %cond, 0 |
| 19 | br i1 %tmp, label %if, label %else |
| 20 | |
| 21 | if: ; preds = %entry |
| 22 | %tmp1 = getelementptr i32 addrspace(1)* %out, i32 1 |
| 23 | %tmp2 = extractelement <4 x i32> %sgpr, i32 1 |
| 24 | store i32 %tmp2, i32 addrspace(1)* %out |
| 25 | br label %endif |
| 26 | |
| 27 | else: ; preds = %entry |
| 28 | %tmp3 = extractelement <4 x i32> %sgpr, i32 2 |
| 29 | %tmp4 = sub i32 %vgpr, %tmp3 |
| 30 | store i32 %tmp4, i32 addrspace(1)* %out |
| 31 | br label %endif |
| 32 | |
| 33 | endif: ; preds = %else, %if |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | ; Function Attrs: nounwind readnone |
| 38 | declare i32 @llvm.r600.read.tidig.x() #0 |
| 39 | |
| 40 | attributes #0 = { nounwind readnone } |
| 41 | attributes #1 = { readnone } |