Add testcases for BEXTR.

These BEXTR cases are a check for the 64-bit load form and two negative cases where the bitrange is non-contiguous.  From a private patch equivalent to r189742/PR17028.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232580 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Josh Magee 2015-03-18 01:34:06 +00:00
parent dbe964d3a6
commit cbaefea0c0

View File

@ -145,6 +145,36 @@ define i64 @bextr64b(i64 %x) nounwind uwtable readnone ssp {
; CHECK: bextrq
}
define i64 @bextr64b_load(i64* %x) {
%1 = load i64, i64* %x, align 8
%2 = lshr i64 %1, 4
%3 = and i64 %2, 4095
ret i64 %3
; CHECK-LABEL: bextr64b_load:
; CHECK: bextrq {{.*}}, ({{.*}}), {{.*}}
}
define i32 @non_bextr32(i32 %x) {
entry:
%shr = lshr i32 %x, 2
%and = and i32 %shr, 111
ret i32 %and
; CHECK-LABEL: non_bextr32:
; CHECK: shrl $2
; CHECK: andl $111
}
define i64 @non_bextr64(i64 %x) {
entry:
%shr = lshr i64 %x, 2
%and = and i64 %shr, 8589934590
ret i64 %and
; CHECK-LABEL: non_bextr64:
; CHECK: shrq $2
; CHECK: movabsq $8589934590
; CHECK: andq
}
define i32 @bzhi32(i32 %x, i32 %y) nounwind readnone {
%tmp = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %x, i32 %y)
ret i32 %tmp