Tom Stellard | 75aadc2 | 2012-12-11 21:25:42 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s |
| 2 | |
| 3 | ; The code generated by sdiv is long and complex and may frequently change. |
| 4 | ; The goal of this test is to make sure the ISel doesn't fail. |
| 5 | ; |
| 6 | ; This program was previously failing to compile when one of the selectcc |
| 7 | ; opcodes generated by the sdiv lowering was being legalized and optimized to: |
| 8 | ; selectcc Remainder -1, 0, -1, SETGT |
| 9 | ; This was fixed by adding an additional pattern in R600Instructions.td to |
| 10 | ; match this pattern with a CNDGE_INT. |
| 11 | |
| 12 | ; CHECK: RETURN |
| 13 | |
| 14 | define void @test(i32 addrspace(1)* %out, i32 addrspace(1)* %in) { |
| 15 | %den_ptr = getelementptr i32 addrspace(1)* %in, i32 1 |
| 16 | %num = load i32 addrspace(1) * %in |
| 17 | %den = load i32 addrspace(1) * %den_ptr |
| 18 | %result = sdiv i32 %num, %den |
| 19 | store i32 %result, i32 addrspace(1)* %out |
| 20 | ret void |
| 21 | } |