|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v2 | FileCheck %s --check-prefixes=CHECK,NOBMI |
| 3 | +; RUN: llc < %s -mtriple=x86_64-- -mcpu=x86-64-v3 | FileCheck %s --check-prefixes=CHECK,BMI |
| 4 | + |
| 5 | +define i64 @foo(i64 %w, i64 %x, i64 %y, i64 %z) { |
| 6 | +; NOBMI-LABEL: foo: |
| 7 | +; NOBMI: # %bb.0: # %Entry |
| 8 | +; NOBMI-NEXT: movq %rcx, %rax |
| 9 | +; NOBMI-NEXT: andq %rdx, %rsi |
| 10 | +; NOBMI-NEXT: notq %rsi |
| 11 | +; NOBMI-NEXT: andq %rdi, %rsi |
| 12 | +; NOBMI-NEXT: notq %rax |
| 13 | +; NOBMI-NEXT: orq %rdx, %rax |
| 14 | +; NOBMI-NEXT: andq %rsi, %rax |
| 15 | +; NOBMI-NEXT: retq |
| 16 | +; |
| 17 | +; BMI-LABEL: foo: |
| 18 | +; BMI: # %bb.0: # %Entry |
| 19 | +; BMI-NEXT: andq %rdx, %rsi |
| 20 | +; BMI-NEXT: andnq %rdi, %rsi, %rax |
| 21 | +; BMI-NEXT: andnq %rcx, %rdx, %rcx |
| 22 | +; BMI-NEXT: andnq %rax, %rcx, %rax |
| 23 | +; BMI-NEXT: retq |
| 24 | +Entry: |
| 25 | + %and1 = and i64 %y, %x |
| 26 | + %xor1 = xor i64 %and1, -1 |
| 27 | + %and2 = and i64 %xor1, %w |
| 28 | + %.not = xor i64 %z, -1 |
| 29 | + %or1 = or i64 %.not, %y |
| 30 | + %and3 = and i64 %and2, %or1 |
| 31 | + ret i64 %and3 |
| 32 | +} |
| 33 | + |
| 34 | +define <16 x i8> @fooVec(<16 x i8> %w, <16 x i8> %x, <16 x i8> %y, <16 x i8> %z) { |
| 35 | +; NOBMI-LABEL: fooVec: |
| 36 | +; NOBMI: # %bb.0: # %Entry |
| 37 | +; NOBMI-NEXT: andps %xmm2, %xmm1 |
| 38 | +; NOBMI-NEXT: andnps %xmm0, %xmm1 |
| 39 | +; NOBMI-NEXT: andnps %xmm3, %xmm2 |
| 40 | +; NOBMI-NEXT: andnps %xmm1, %xmm2 |
| 41 | +; NOBMI-NEXT: movaps %xmm2, %xmm0 |
| 42 | +; NOBMI-NEXT: retq |
| 43 | +; |
| 44 | +; BMI-LABEL: fooVec: |
| 45 | +; BMI: # %bb.0: # %Entry |
| 46 | +; BMI-NEXT: vandps %xmm1, %xmm2, %xmm1 |
| 47 | +; BMI-NEXT: vandnps %xmm0, %xmm1, %xmm0 |
| 48 | +; BMI-NEXT: vandnps %xmm3, %xmm2, %xmm1 |
| 49 | +; BMI-NEXT: vandnps %xmm0, %xmm1, %xmm0 |
| 50 | +; BMI-NEXT: retq |
| 51 | +Entry: |
| 52 | + %and1 = and <16 x i8> %y, %x |
| 53 | + %xor1 = xor <16 x i8> %and1, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> |
| 54 | + %and2 = and <16 x i8> %xor1, %w |
| 55 | + %.not = xor <16 x i8> %z, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> |
| 56 | + %or1 = or <16 x i8> %.not, %y |
| 57 | + %and3 = and <16 x i8> %and2, %or1 |
| 58 | + ret <16 x i8> %and3 |
| 59 | +} |
| 60 | +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: |
| 61 | +; CHECK: {{.*}} |
0 commit comments