| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s |
| 3 | |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 4 | define i32 @mask_negated_zext_bool1(i1 %x) { |
| 5 | ; CHECK-LABEL: mask_negated_zext_bool1: |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 6 | ; CHECK: # BB#0: |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 7 | ; CHECK-NEXT: andl $1, %edi |
| 8 | ; CHECK-NEXT: movl %edi, %eax |
| 9 | ; CHECK-NEXT: retq |
| 10 | ; |
| 11 | %ext = zext i1 %x to i32 |
| 12 | %neg = sub i32 0, %ext |
| 13 | %and = and i32 %neg, 1 |
| 14 | ret i32 %and |
| 15 | } |
| 16 | |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 17 | define i32 @mask_negated_zext_bool2(i1 zeroext %x) { |
| 18 | ; CHECK-LABEL: mask_negated_zext_bool2: |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 19 | ; CHECK: # BB#0: |
| 20 | ; CHECK-NEXT: movzbl %dil, %eax |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 21 | ; CHECK-NEXT: retq |
| 22 | ; |
| 23 | %ext = zext i1 %x to i32 |
| 24 | %neg = sub i32 0, %ext |
| 25 | %and = and i32 %neg, 1 |
| 26 | ret i32 %and |
| 27 | } |
| 28 | |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 29 | define <4 x i32> @mask_negated_zext_bool_vec(<4 x i1> %x) { |
| 30 | ; CHECK-LABEL: mask_negated_zext_bool_vec: |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 31 | ; CHECK: # BB#0: |
| Sanjay Patel | 8384703 | 2016-10-11 16:26:36 +0000 | [diff] [blame] | 32 | ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0 |
| Sanjay Patel | 9b3c8a7 | 2016-10-11 16:04:37 +0000 | [diff] [blame] | 33 | ; CHECK-NEXT: retq |
| 34 | ; |
| 35 | %ext = zext <4 x i1> %x to <4 x i32> |
| 36 | %neg = sub <4 x i32> zeroinitializer, %ext |
| 37 | %and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1> |
| 38 | ret <4 x i32> %and |
| 39 | } |
| 40 | |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 41 | define i32 @mask_negated_sext_bool1(i1 %x) { |
| 42 | ; CHECK-LABEL: mask_negated_sext_bool1: |
| 43 | ; CHECK: # BB#0: |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 44 | ; CHECK-NEXT: andl $1, %edi |
| 45 | ; CHECK-NEXT: movl %edi, %eax |
| 46 | ; CHECK-NEXT: retq |
| 47 | ; |
| 48 | %ext = sext i1 %x to i32 |
| 49 | %neg = sub i32 0, %ext |
| 50 | %and = and i32 %neg, 1 |
| 51 | ret i32 %and |
| 52 | } |
| 53 | |
| 54 | define i32 @mask_negated_sext_bool2(i1 zeroext %x) { |
| 55 | ; CHECK-LABEL: mask_negated_sext_bool2: |
| 56 | ; CHECK: # BB#0: |
| 57 | ; CHECK-NEXT: movzbl %dil, %eax |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 58 | ; CHECK-NEXT: retq |
| 59 | ; |
| 60 | %ext = sext i1 %x to i32 |
| 61 | %neg = sub i32 0, %ext |
| 62 | %and = and i32 %neg, 1 |
| 63 | ret i32 %and |
| 64 | } |
| 65 | |
| 66 | define <4 x i32> @mask_negated_sext_bool_vec(<4 x i1> %x) { |
| 67 | ; CHECK-LABEL: mask_negated_sext_bool_vec: |
| 68 | ; CHECK: # BB#0: |
| Sanjay Patel | 8253e15 | 2016-10-11 17:05:52 +0000 | [diff] [blame] | 69 | ; CHECK-NEXT: andps {{.*}}(%rip), %xmm0 |
| Sanjay Patel | 58b4987 | 2016-10-11 16:49:52 +0000 | [diff] [blame] | 70 | ; CHECK-NEXT: retq |
| 71 | ; |
| 72 | %ext = sext <4 x i1> %x to <4 x i32> |
| 73 | %neg = sub <4 x i32> zeroinitializer, %ext |
| 74 | %and = and <4 x i32> %neg, <i32 1, i32 1, i32 1, i32 1> |
| 75 | ret <4 x i32> %and |
| 76 | } |
| 77 | |