Florian Hahn | f8045b2 | 2020-02-14 00:05:50 +0100 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: opt < %s -sccp -S | FileCheck %s |
Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 3 | |
| 4 | @A = constant i32 10 |
| 5 | |
| 6 | define i712 @test1() { |
Florian Hahn | f8045b2 | 2020-02-14 00:05:50 +0100 | [diff] [blame] | 7 | ; CHECK-LABEL: @test1( |
| 8 | ; CHECK-NEXT: [[BB:%.*]] = and i64 ptrtoint (i32* @A to i64), undef |
| 9 | ; CHECK-NEXT: [[C:%.*]] = icmp sge i64 [[BB]], 0 |
| 10 | ; CHECK-NEXT: [[X:%.*]] = select i1 [[C]], i712 0, i712 1 |
| 11 | ; CHECK-NEXT: ret i712 [[X]] |
| 12 | ; |
| 13 | %P = getelementptr i32, i32* @A, i32 0 |
| 14 | %B = ptrtoint i32* %P to i64 |
| 15 | %BB = and i64 %B, undef |
| 16 | %C = icmp sge i64 %BB, 0 |
| 17 | %X = select i1 %C, i712 0, i712 1 |
| 18 | ret i712 %X |
Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | |
| 22 | |
| 23 | define i712 @test2(i1 %C) { |
Florian Hahn | f8045b2 | 2020-02-14 00:05:50 +0100 | [diff] [blame] | 24 | ; CHECK-LABEL: @test2( |
| 25 | ; CHECK-NEXT: ret i712 0 |
| 26 | ; |
| 27 | %X = select i1 %C, i712 0, i712 undef |
| 28 | ret i712 %X |
Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 29 | } |