mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 08:26:29 +00:00
[WebAssembly] Implement the is_zero_undef forms of cttz and ctlz
llvm-svn: 245851
This commit is contained in:
parent
4e03bf749d
commit
8c96f82ac6
@ -40,3 +40,9 @@ defm UGE : ComparisonInt<SETUGE>;
|
||||
defm CLZ : UnaryInt<ctlz>;
|
||||
defm CTZ : UnaryInt<cttz>;
|
||||
defm POPCNT : UnaryInt<ctpop>;
|
||||
|
||||
// Expand the "don't care" operations to supported operations.
|
||||
def : Pat<(ctlz_zero_undef Int32:$src), (CLZ_I32 Int32:$src)>;
|
||||
def : Pat<(ctlz_zero_undef Int64:$src), (CLZ_I64 Int64:$src)>;
|
||||
def : Pat<(cttz_zero_undef Int32:$src), (CTZ_I32 Int32:$src)>;
|
||||
def : Pat<(cttz_zero_undef Int64:$src), (CTZ_I64 Int64:$src)>;
|
||||
|
@ -148,6 +148,15 @@ define i32 @clz32(i32 %x) {
|
||||
ret i32 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: clz32_zero_undef:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (clz @0))
|
||||
; CHECK-NEXT: (return @1)
|
||||
define i32 @clz32_zero_undef(i32 %x) {
|
||||
%a = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
|
||||
ret i32 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: ctz32:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (ctz @0))
|
||||
@ -157,6 +166,15 @@ define i32 @ctz32(i32 %x) {
|
||||
ret i32 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: ctz32_zero_undef:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (ctz @0))
|
||||
; CHECK-NEXT: (return @1)
|
||||
define i32 @ctz32_zero_undef(i32 %x) {
|
||||
%a = call i32 @llvm.cttz.i32(i32 %x, i1 true)
|
||||
ret i32 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: popcnt32:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (popcnt @0))
|
||||
|
@ -148,6 +148,15 @@ define i64 @clz64(i64 %x) {
|
||||
ret i64 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: clz64_zero_undef:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (clz @0))
|
||||
; CHECK-NEXT: (return @1)
|
||||
define i64 @clz64_zero_undef(i64 %x) {
|
||||
%a = call i64 @llvm.ctlz.i64(i64 %x, i1 true)
|
||||
ret i64 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: ctz64:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (ctz @0))
|
||||
@ -157,6 +166,15 @@ define i64 @ctz64(i64 %x) {
|
||||
ret i64 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: ctz64_zero_undef:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (ctz @0))
|
||||
; CHECK-NEXT: (return @1)
|
||||
define i64 @ctz64_zero_undef(i64 %x) {
|
||||
%a = call i64 @llvm.cttz.i64(i64 %x, i1 true)
|
||||
ret i64 %a
|
||||
}
|
||||
|
||||
; CHECK-LABEL: popcnt64:
|
||||
; CHECK-NEXT: (setlocal @0 (argument 0))
|
||||
; CHECK-NEXT: (setlocal @1 (popcnt @0))
|
||||
|
Loading…
Reference in New Issue
Block a user