llvm.org GIT mirror llvm / 62352f8
[x86] add vector tests for demanded bits; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302949 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 years ago
1 changed file(s) with 26 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
12 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-bmi | FileCheck %s --check-prefix=ALL --check-prefix=NO_BMI
23 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi | FileCheck %s --check-prefix=ALL --check-prefix=BMI
1011 ; ALL-NEXT: xorl $1, %edi
1112 ; ALL-NEXT: movl %edi, %eax
1213 ; ALL-NEXT: retq
13 ;
1414 %sh = lshr i32 %x, 31
1515 %not = xor i32 %sh, -1
1616 %and = and i32 %not, 1
1717 ret i32 %and
18 }
19
20 define <4 x i32> @shrink_xor_constant1_splat(<4 x i32> %x) {
21 ; ALL-LABEL: shrink_xor_constant1_splat:
22 ; ALL: # BB#0:
23 ; ALL-NEXT: psrld $31, %xmm0
24 ; ALL-NEXT: pandn {{.*}}(%rip), %xmm0
25 ; ALL-NEXT: retq
26 %sh = lshr <4 x i32> %x,
27 %not = xor <4 x i32> %sh,
28 %and = and <4 x i32> %not,
29 ret <4 x i32> %and
1830 }
1931
2032 ; Clear low bits via shift, set them with xor (not), then mask them off.
2638 ; ALL-NEXT: xorb $-32, %dil
2739 ; ALL-NEXT: movl %edi, %eax
2840 ; ALL-NEXT: retq
29 ;
3041 %sh = shl i8 %x, 5
3142 %not = xor i8 %sh, -1
3243 %and = and i8 %not, 224 ; 0xE0
3344 ret i8 %and
3445 }
3546
47 define <16 x i8> @shrink_xor_constant2_splat(<16 x i8> %x) {
48 ; ALL-LABEL: shrink_xor_constant2_splat:
49 ; ALL: # BB#0:
50 ; ALL-NEXT: psllw $5, %xmm0
51 ; ALL-NEXT: pand {{.*}}(%rip), %xmm0
52 ; ALL-NEXT: pandn {{.*}}(%rip), %xmm0
53 ; ALL-NEXT: retq
54 %sh = shl <16 x i8> %x,
55 %not = xor <16 x i8> %sh,
56 %and = and <16 x i8> %not,
57 ret <16 x i8> %and
58 }
59