1; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=0 | \ 2; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s 3; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \ 4; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWON %s 5; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -fixup-byte-word-insts=0 | \ 6; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s 7; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \ 8; RUN: FileCheck -check-prefix=CHECK -check-prefix=BWON %s 9; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck -check-prefix=DARWIN %s 10 11 12@x = common global i32 0, align 4 13 14define zeroext i1 @unsigned_i1() { 15entry: 16 %0 = load i32, i32* @x 17 %cmp = icmp eq i32 %0, 42 18 ret i1 %cmp 19 20; Unsigned i1 return values are not extended. 21; CHECK-LABEL: unsigned_i1: 22; CHECK: cmp 23; CHECK-NEXT: sete 24; CHECK-NEXT: ret 25} 26 27define zeroext i8 @unsigned_i8() { 28entry: 29 %0 = load i32, i32* @x 30 %cmp = icmp eq i32 %0, 42 31 %retval = zext i1 %cmp to i8 32 ret i8 %retval 33 34; Unsigned i8 return values are not extended. 35; CHECK-LABEL: unsigned_i8: 36; CHECK: cmp 37; CHECK-NEXT: sete 38; CHECK-NEXT: ret 39 40; Except on Darwin, for legacy reasons. 41; DARWIN-LABEL: unsigned_i8: 42; DARWIN: cmp 43; DARWIN-NEXT: sete 44; DARWIN-NEXT: movzbl 45; DARWIN-NEXT: ret 46} 47 48define signext i8 @signed_i8() { 49entry: 50 %0 = load i32, i32* @x 51 %cmp = icmp eq i32 %0, 42 52 %retval = zext i1 %cmp to i8 53 ret i8 %retval 54 55; Signed i8 return values are not extended. 56; CHECK-LABEL: signed_i8: 57; CHECK: cmp 58; CHECK-NEXT: sete 59; CHECK-NEXT: ret 60 61; Except on Darwin, for legacy reasons. 62; DARWIN-LABEL: signed_i8: 63; DARWIN: cmp 64; DARWIN-NEXT: sete 65; DARWIN-NEXT: movzbl 66; DARWIN-NEXT: ret 67} 68 69@a = common global i16 0 70@b = common global i16 0 71define zeroext i16 @unsigned_i16() { 72entry: 73 %0 = load i16, i16* @a 74 %1 = load i16, i16* @b 75 %add = add i16 %1, %0 76 ret i16 %add 77 78; i16 return values are not extended. 79; CHECK-LABEL: unsigned_i16: 80; BWOFF: movw 81; BWON: movzwl 82; CHECK-NEXT: addw 83; CHECK-NEXT: ret 84 85; Except on Darwin, for legay reasons. 86; DARWIN-LABEL: unsigned_i16: 87; DARWIN: movw 88; DARWIN-NEXT: addw 89; DARWIN-NEXT: movzwl 90; DARWIN-NEXT: ret 91} 92 93 94define i32 @use_i1() { 95entry: 96 %0 = call i1 @unsigned_i1(); 97 %1 = zext i1 %0 to i32 98 ret i32 %1 99 100; The high 24 bits of %eax from a function returning i1 are undefined. 101; CHECK-LABEL: use_i1: 102; CHECK: call 103; CHECK-NEXT: movzbl 104; CHECK-NEXT: {{pop|add}} 105; CHECK-NEXT: ret 106} 107 108define i32 @use_i8() { 109entry: 110 %0 = call i8 @unsigned_i8(); 111 %1 = zext i8 %0 to i32 112 ret i32 %1 113 114; The high 24 bits of %eax from a function returning i8 are undefined. 115; CHECK-LABEL: use_i8: 116; CHECK: call 117; CHECK-NEXT: movzbl 118; CHECK-NEXT: {{pop|add}} 119; CHECK-NEXT: ret 120} 121 122define i32 @use_i16() { 123entry: 124 %0 = call i16 @unsigned_i16(); 125 %1 = zext i16 %0 to i32 126 ret i32 %1 127 128; The high 16 bits of %eax from a function returning i16 are undefined. 129; CHECK-LABEL: use_i16: 130; CHECK: call 131; CHECK-NEXT: movzwl 132; CHECK-NEXT: {{pop|add}} 133; CHECK-NEXT: ret 134} 135