2012-03-31 20:59:07 +02:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
|
2012-03-31 20:14:00 +02:00
|
|
|
|
|
|
|
define zeroext i1 @f1(i8* %x) {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: f1:
|
2012-04-09 18:06:03 +02:00
|
|
|
; CHECK: movb (%rdi), %al
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
|
2012-03-31 20:14:00 +02:00
|
|
|
entry:
|
|
|
|
%0 = load i8* %x, align 1, !range !0
|
|
|
|
%tobool = trunc i8 %0 to i1
|
|
|
|
ret i1 %tobool
|
|
|
|
}
|
|
|
|
|
2012-04-09 18:06:03 +02:00
|
|
|
define zeroext i1 @f2(i8* %x) {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: f2:
|
2012-03-31 20:14:00 +02:00
|
|
|
; CHECK: movb (%rdi), %al
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
|
2012-04-09 18:06:03 +02:00
|
|
|
entry:
|
|
|
|
%0 = load i8* %x, align 1, !range !0
|
|
|
|
%tobool = icmp ne i8 %0, 0
|
|
|
|
ret i1 %tobool
|
|
|
|
}
|
|
|
|
|
2012-03-31 20:14:00 +02:00
|
|
|
!0 = metadata !{i8 0, i8 2}
|
2012-04-09 18:06:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
; check that we don't build a "trunc" from i1 to i1, which would assert.
|
|
|
|
define zeroext i1 @f3(i1 %x) {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: f3:
|
2012-04-09 18:06:03 +02:00
|
|
|
|
|
|
|
entry:
|
|
|
|
%tobool = icmp ne i1 %x, 0
|
|
|
|
ret i1 %tobool
|
|
|
|
}
|
|
|
|
|
|
|
|
; check that we don't build a trunc when other bits are needed
|
|
|
|
define zeroext i1 @f4(i32 %x) {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: f4:
|
2012-04-09 18:06:03 +02:00
|
|
|
; CHECK: and
|
|
|
|
|
|
|
|
entry:
|
|
|
|
%y = and i32 %x, 32768
|
|
|
|
%z = icmp ne i32 %y, 0
|
|
|
|
ret i1 %z
|
|
|
|
}
|