1 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=CHECK-64 2 ; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s --check-prefix=CHECK-64 3 ; RUN: llc < %s -march=x86 | FileCheck %s --check-prefix=CHECK-32 4 5 ; CHECK-64-LABEL: g64xh: 6 ; CHECK-64: testb $8, {{%ah|%ch}} 7 ; CHECK-64: ret 8 ; CHECK-32-LABEL: g64xh: 9 ; CHECK-32: testb $8, %ah 10 ; CHECK-32: ret 11 define void @g64xh(i64 inreg %x) nounwind { 12 %t = and i64 %x, 2048 13 %s = icmp eq i64 %t, 0 14 br i1 %s, label %yes, label %no 15 16 yes: 17 call void @bar() 18 ret void 19 no: 20 ret void 21 } 22 ; CHECK-64-LABEL: g64xl: 23 ; CHECK-64: testb $8, [[A0L:%dil|%cl]] 24 ; CHECK-64: ret 25 ; CHECK-32-LABEL: g64xl: 26 ; CHECK-32: testb $8, %al 27 ; CHECK-32: ret 28 define void @g64xl(i64 inreg %x) nounwind { 29 %t = and i64 %x, 8 30 %s = icmp eq i64 %t, 0 31 br i1 %s, label %yes, label %no 32 33 yes: 34 call void @bar() 35 ret void 36 no: 37 ret void 38 } 39 ; CHECK-64-LABEL: g32xh: 40 ; CHECK-64: testb $8, {{%ah|%ch}} 41 ; CHECK-64: ret 42 ; CHECK-32-LABEL: g32xh: 43 ; CHECK-32: testb $8, %ah 44 ; CHECK-32: ret 45 define void @g32xh(i32 inreg %x) nounwind { 46 %t = and i32 %x, 2048 47 %s = icmp eq i32 %t, 0 48 br i1 %s, label %yes, label %no 49 50 yes: 51 call void @bar() 52 ret void 53 no: 54 ret void 55 } 56 ; CHECK-64-LABEL: g32xl: 57 ; CHECK-64: testb $8, [[A0L]] 58 ; CHECK-64: ret 59 ; CHECK-32-LABEL: g32xl: 60 ; CHECK-32: testb $8, %al 61 ; CHECK-32: ret 62 define void @g32xl(i32 inreg %x) nounwind { 63 %t = and i32 %x, 8 64 %s = icmp eq i32 %t, 0 65 br i1 %s, label %yes, label %no 66 67 yes: 68 call void @bar() 69 ret void 70 no: 71 ret void 72 } 73 ; CHECK-64-LABEL: g16xh: 74 ; CHECK-64: testb $8, {{%ah|%ch}} 75 ; CHECK-64: ret 76 ; CHECK-32-LABEL: g16xh: 77 ; CHECK-32: testb $8, %ah 78 ; CHECK-32: ret 79 define void @g16xh(i16 inreg %x) nounwind { 80 %t = and i16 %x, 2048 81 %s = icmp eq i16 %t, 0 82 br i1 %s, label %yes, label %no 83 84 yes: 85 call void @bar() 86 ret void 87 no: 88 ret void 89 } 90 ; CHECK-64-LABEL: g16xl: 91 ; CHECK-64: testb $8, [[A0L]] 92 ; CHECK-64: ret 93 ; CHECK-32-LABEL: g16xl: 94 ; CHECK-32: testb $8, %al 95 ; CHECK-32: ret 96 define void @g16xl(i16 inreg %x) nounwind { 97 %t = and i16 %x, 8 98 %s = icmp eq i16 %t, 0 99 br i1 %s, label %yes, label %no 100 101 yes: 102 call void @bar() 103 ret void 104 no: 105 ret void 106 } 107 ; CHECK-64-LABEL: g64x16: 108 ; CHECK-64: testw $-32640, %[[A0W:di|cx]] 109 ; CHECK-64: ret 110 ; CHECK-32-LABEL: g64x16: 111 ; CHECK-32: testw $-32640, %ax 112 ; CHECK-32: ret 113 define void @g64x16(i64 inreg %x) nounwind { 114 %t = and i64 %x, 32896 115 %s = icmp eq i64 %t, 0 116 br i1 %s, label %yes, label %no 117 118 yes: 119 call void @bar() 120 ret void 121 no: 122 ret void 123 } 124 ; CHECK-64-LABEL: g32x16: 125 ; CHECK-64: testw $-32640, %[[A0W]] 126 ; CHECK-64: ret 127 ; CHECK-32-LABEL: g32x16: 128 ; CHECK-32: testw $-32640, %ax 129 ; CHECK-32: ret 130 define void @g32x16(i32 inreg %x) nounwind { 131 %t = and i32 %x, 32896 132 %s = icmp eq i32 %t, 0 133 br i1 %s, label %yes, label %no 134 135 yes: 136 call void @bar() 137 ret void 138 no: 139 ret void 140 } 141 ; CHECK-64-LABEL: g64x32: 142 ; CHECK-64: testl $268468352, %e[[A0W]] 143 ; CHECK-64: ret 144 ; CHECK-32-LABEL: g64x32: 145 ; CHECK-32: testl $268468352, %eax 146 ; CHECK-32: ret 147 define void @g64x32(i64 inreg %x) nounwind { 148 %t = and i64 %x, 268468352 149 %s = icmp eq i64 %t, 0 150 br i1 %s, label %yes, label %no 151 152 yes: 153 call void @bar() 154 ret void 155 no: 156 ret void 157 } 158 159 declare void @bar() 160