Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -o - %s | FileCheck %s |
Tim Northover | e0e3aef | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 2 | |
| 3 | ; Most important point here is that the promotion of the i1 works |
| 4 | ; correctly. Previously LLVM thought that i64 was the appropriate SetCC output, |
| 5 | ; which meant it proceded in two steps and produced an i64 -> i64 any_ext which |
| 6 | ; couldn't be selected and faulted. |
| 7 | |
| 8 | ; It was expecting the smallest legal promotion of i1 to be the preferred SetCC |
| 9 | ; type, so we'll satisfy it (this actually arguably gives better code anyway, |
| 10 | ; with flag-manipulation operations allowed to use W-registers). |
| 11 | |
| 12 | declare {i64, i1} @llvm.umul.with.overflow.i64(i64, i64) |
| 13 | |
| 14 | define i64 @test_select(i64 %lhs, i64 %rhs) { |
Stephen Lin | f799e3f | 2013-07-13 20:38:47 +0000 | [diff] [blame] | 15 | ; CHECK-LABEL: test_select: |
Tim Northover | e0e3aef | 2013-01-31 12:12:40 +0000 | [diff] [blame] | 16 | |
| 17 | %res = call {i64, i1} @llvm.umul.with.overflow.i64(i64 %lhs, i64 %rhs) |
| 18 | %flag = extractvalue {i64, i1} %res, 1 |
| 19 | %retval = select i1 %flag, i64 %lhs, i64 %rhs |
| 20 | ret i64 %retval |
| 21 | ; CHECK: ret |
Stephen Lin | f799e3f | 2013-07-13 20:38:47 +0000 | [diff] [blame] | 22 | } |