1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
4 define zeroext i1 @f1(i8* %x) {
6 ; CHECK: ## %bb.0: ## %entry
7 ; CHECK-NEXT: movb (%rdi), %al
11 %0 = load i8, i8* %x, align 1, !range !0
12 %tobool = trunc i8 %0 to i1
16 define zeroext i1 @f2(i8* %x) {
18 ; CHECK: ## %bb.0: ## %entry
19 ; CHECK-NEXT: movb (%rdi), %al
23 %0 = load i8, i8* %x, align 1, !range !0
24 %tobool = icmp ne i8 %0, 0
31 ; check that we don't build a "trunc" from i1 to i1, which would assert.
32 define zeroext i1 @f3(i1 %x) {
34 ; CHECK: ## %bb.0: ## %entry
35 ; CHECK-NEXT: movl %edi, %eax
36 ; CHECK-NEXT: andb $1, %al
37 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
41 %tobool = icmp ne i1 %x, 0
45 ; check that we don't build a trunc when other bits are needed
46 define zeroext i1 @f4(i32 %x) {
48 ; CHECK: ## %bb.0: ## %entry
49 ; CHECK-NEXT: movzwl %di, %eax
50 ; CHECK-NEXT: shrl $15, %eax
51 ; CHECK-NEXT: ## kill: def $al killed $al killed $eax
55 %y = and i32 %x, 32768
56 %z = icmp ne i32 %y, 0