From: Dan Gohman Date: Tue, 29 Sep 2015 08:13:58 +0000 (+0000) Subject: [WebAssembly] Rename test files to match platform naming conventions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e2adff7685023916aa54b25bbaa49b3a9689f022;p=oota-llvm.git [WebAssembly] Rename test files to match platform naming conventions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248783 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/WebAssembly/f32.ll b/test/CodeGen/WebAssembly/f32.ll new file mode 100644 index 00000000000..35f6c4207d7 --- /dev/null +++ b/test/CodeGen/WebAssembly/f32.ll @@ -0,0 +1,110 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that basic 32-bit floating-point operations assemble as expected. + +target datalayout = "e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +declare float @llvm.fabs.f32(float) +declare float @llvm.copysign.f32(float, float) +declare float @llvm.sqrt.f32(float) +declare float @llvm.ceil.f32(float) +declare float @llvm.floor.f32(float) +declare float @llvm.trunc.f32(float) +declare float @llvm.nearbyint.f32(float) +declare float @llvm.rint.f32(float) + +; CHECK-LABEL: (func $fadd32 +; CHECK-NEXT: (param f32) (param f32) (result f32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (fadd @1 @0)) +; CHECK-NEXT: (return @2) +define float @fadd32(float %x, float %y) { + %a = fadd float %x, %y + ret float %a +} + +; CHECK-LABEL: (func $fsub32 +; CHECK: (setlocal @2 (fsub @1 @0)) +define float @fsub32(float %x, float %y) { + %a = fsub float %x, %y + ret float %a +} + +; CHECK-LABEL: (func $fmul32 +; CHECK: (setlocal @2 (fmul @1 @0)) +define float @fmul32(float %x, float %y) { + %a = fmul float %x, %y + ret float %a +} + +; CHECK-LABEL: (func $fdiv32 +; CHECK: (setlocal @2 (fdiv @1 @0)) +define float @fdiv32(float %x, float %y) { + %a = fdiv float %x, %y + ret float %a +} + +; CHECK-LABEL: (func $fabs32 +; CHECK: (setlocal @1 (fabs @0)) +define float @fabs32(float %x) { + %a = call float @llvm.fabs.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $fneg32 +; CHECK: (setlocal @1 (fneg @0)) +define float @fneg32(float %x) { + %a = fsub float -0., %x + ret float %a +} + +; CHECK-LABEL: (func $copysign32 +; CHECK: (setlocal @2 (copysign @1 @0)) +define float @copysign32(float %x, float %y) { + %a = call float @llvm.copysign.f32(float %x, float %y) + ret float %a +} + +; CHECK-LABEL: (func $sqrt32 +; CHECK: (setlocal @1 (sqrt @0)) +define float @sqrt32(float %x) { + %a = call float @llvm.sqrt.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $ceil32 +; CHECK: (setlocal @1 (ceil @0)) +define float @ceil32(float %x) { + %a = call float @llvm.ceil.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $floor32 +; CHECK: (setlocal @1 (floor @0)) +define float @floor32(float %x) { + %a = call float @llvm.floor.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $trunc32 +; CHECK: (setlocal @1 (trunc @0)) +define float @trunc32(float %x) { + %a = call float @llvm.trunc.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $nearest32 +; CHECK: (setlocal @1 (nearest @0)) +define float @nearest32(float %x) { + %a = call float @llvm.nearbyint.f32(float %x) + ret float %a +} + +; CHECK-LABEL: (func $nearest32_via_rint +; CHECK: (setlocal @1 (nearest @0)) +define float @nearest32_via_rint(float %x) { + %a = call float @llvm.rint.f32(float %x) + ret float %a +} diff --git a/test/CodeGen/WebAssembly/f64.ll b/test/CodeGen/WebAssembly/f64.ll new file mode 100644 index 00000000000..cbe1ed4434c --- /dev/null +++ b/test/CodeGen/WebAssembly/f64.ll @@ -0,0 +1,110 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that basic 64-bit floating-point operations assemble as expected. + +target datalayout = "e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +declare double @llvm.fabs.f64(double) +declare double @llvm.copysign.f64(double, double) +declare double @llvm.sqrt.f64(double) +declare double @llvm.ceil.f64(double) +declare double @llvm.floor.f64(double) +declare double @llvm.trunc.f64(double) +declare double @llvm.nearbyint.f64(double) +declare double @llvm.rint.f64(double) + +; CHECK-LABEL: (func $fadd64 +; CHECK-NEXT: (param f64) (param f64) (result f64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (fadd @1 @0)) +; CHECK-NEXT: (return @2) +define double @fadd64(double %x, double %y) { + %a = fadd double %x, %y + ret double %a +} + +; CHECK-LABEL: (func $fsub64 +; CHECK: (setlocal @2 (fsub @1 @0)) +define double @fsub64(double %x, double %y) { + %a = fsub double %x, %y + ret double %a +} + +; CHECK-LABEL: (func $fmul64 +; CHECK: (setlocal @2 (fmul @1 @0)) +define double @fmul64(double %x, double %y) { + %a = fmul double %x, %y + ret double %a +} + +; CHECK-LABEL: (func $fdiv64 +; CHECK: (setlocal @2 (fdiv @1 @0)) +define double @fdiv64(double %x, double %y) { + %a = fdiv double %x, %y + ret double %a +} + +; CHECK-LABEL: (func $fabs64 +; CHECK: (setlocal @1 (fabs @0)) +define double @fabs64(double %x) { + %a = call double @llvm.fabs.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $fneg64 +; CHECK: (setlocal @1 (fneg @0)) +define double @fneg64(double %x) { + %a = fsub double -0., %x + ret double %a +} + +; CHECK-LABEL: (func $copysign64 +; CHECK: (setlocal @2 (copysign @1 @0)) +define double @copysign64(double %x, double %y) { + %a = call double @llvm.copysign.f64(double %x, double %y) + ret double %a +} + +; CHECK-LABEL: (func $sqrt64 +; CHECK: (setlocal @1 (sqrt @0)) +define double @sqrt64(double %x) { + %a = call double @llvm.sqrt.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $ceil64 +; CHECK: (setlocal @1 (ceil @0)) +define double @ceil64(double %x) { + %a = call double @llvm.ceil.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $floor64 +; CHECK: (setlocal @1 (floor @0)) +define double @floor64(double %x) { + %a = call double @llvm.floor.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $trunc64 +; CHECK: (setlocal @1 (trunc @0)) +define double @trunc64(double %x) { + %a = call double @llvm.trunc.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $nearest64 +; CHECK: (setlocal @1 (nearest @0)) +define double @nearest64(double %x) { + %a = call double @llvm.nearbyint.f64(double %x) + ret double %a +} + +; CHECK-LABEL: (func $nearest64_via_rint +; CHECK: (setlocal @1 (nearest @0)) +define double @nearest64_via_rint(double %x) { + %a = call double @llvm.rint.f64(double %x) + ret double %a +} diff --git a/test/CodeGen/WebAssembly/fp32.ll b/test/CodeGen/WebAssembly/fp32.ll deleted file mode 100644 index 35f6c4207d7..00000000000 --- a/test/CodeGen/WebAssembly/fp32.ll +++ /dev/null @@ -1,110 +0,0 @@ -; RUN: llc < %s -asm-verbose=false | FileCheck %s - -; Test that basic 32-bit floating-point operations assemble as expected. - -target datalayout = "e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" - -declare float @llvm.fabs.f32(float) -declare float @llvm.copysign.f32(float, float) -declare float @llvm.sqrt.f32(float) -declare float @llvm.ceil.f32(float) -declare float @llvm.floor.f32(float) -declare float @llvm.trunc.f32(float) -declare float @llvm.nearbyint.f32(float) -declare float @llvm.rint.f32(float) - -; CHECK-LABEL: (func $fadd32 -; CHECK-NEXT: (param f32) (param f32) (result f32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (fadd @1 @0)) -; CHECK-NEXT: (return @2) -define float @fadd32(float %x, float %y) { - %a = fadd float %x, %y - ret float %a -} - -; CHECK-LABEL: (func $fsub32 -; CHECK: (setlocal @2 (fsub @1 @0)) -define float @fsub32(float %x, float %y) { - %a = fsub float %x, %y - ret float %a -} - -; CHECK-LABEL: (func $fmul32 -; CHECK: (setlocal @2 (fmul @1 @0)) -define float @fmul32(float %x, float %y) { - %a = fmul float %x, %y - ret float %a -} - -; CHECK-LABEL: (func $fdiv32 -; CHECK: (setlocal @2 (fdiv @1 @0)) -define float @fdiv32(float %x, float %y) { - %a = fdiv float %x, %y - ret float %a -} - -; CHECK-LABEL: (func $fabs32 -; CHECK: (setlocal @1 (fabs @0)) -define float @fabs32(float %x) { - %a = call float @llvm.fabs.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $fneg32 -; CHECK: (setlocal @1 (fneg @0)) -define float @fneg32(float %x) { - %a = fsub float -0., %x - ret float %a -} - -; CHECK-LABEL: (func $copysign32 -; CHECK: (setlocal @2 (copysign @1 @0)) -define float @copysign32(float %x, float %y) { - %a = call float @llvm.copysign.f32(float %x, float %y) - ret float %a -} - -; CHECK-LABEL: (func $sqrt32 -; CHECK: (setlocal @1 (sqrt @0)) -define float @sqrt32(float %x) { - %a = call float @llvm.sqrt.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $ceil32 -; CHECK: (setlocal @1 (ceil @0)) -define float @ceil32(float %x) { - %a = call float @llvm.ceil.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $floor32 -; CHECK: (setlocal @1 (floor @0)) -define float @floor32(float %x) { - %a = call float @llvm.floor.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $trunc32 -; CHECK: (setlocal @1 (trunc @0)) -define float @trunc32(float %x) { - %a = call float @llvm.trunc.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $nearest32 -; CHECK: (setlocal @1 (nearest @0)) -define float @nearest32(float %x) { - %a = call float @llvm.nearbyint.f32(float %x) - ret float %a -} - -; CHECK-LABEL: (func $nearest32_via_rint -; CHECK: (setlocal @1 (nearest @0)) -define float @nearest32_via_rint(float %x) { - %a = call float @llvm.rint.f32(float %x) - ret float %a -} diff --git a/test/CodeGen/WebAssembly/fp64.ll b/test/CodeGen/WebAssembly/fp64.ll deleted file mode 100644 index cbe1ed4434c..00000000000 --- a/test/CodeGen/WebAssembly/fp64.ll +++ /dev/null @@ -1,110 +0,0 @@ -; RUN: llc < %s -asm-verbose=false | FileCheck %s - -; Test that basic 64-bit floating-point operations assemble as expected. - -target datalayout = "e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" - -declare double @llvm.fabs.f64(double) -declare double @llvm.copysign.f64(double, double) -declare double @llvm.sqrt.f64(double) -declare double @llvm.ceil.f64(double) -declare double @llvm.floor.f64(double) -declare double @llvm.trunc.f64(double) -declare double @llvm.nearbyint.f64(double) -declare double @llvm.rint.f64(double) - -; CHECK-LABEL: (func $fadd64 -; CHECK-NEXT: (param f64) (param f64) (result f64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (fadd @1 @0)) -; CHECK-NEXT: (return @2) -define double @fadd64(double %x, double %y) { - %a = fadd double %x, %y - ret double %a -} - -; CHECK-LABEL: (func $fsub64 -; CHECK: (setlocal @2 (fsub @1 @0)) -define double @fsub64(double %x, double %y) { - %a = fsub double %x, %y - ret double %a -} - -; CHECK-LABEL: (func $fmul64 -; CHECK: (setlocal @2 (fmul @1 @0)) -define double @fmul64(double %x, double %y) { - %a = fmul double %x, %y - ret double %a -} - -; CHECK-LABEL: (func $fdiv64 -; CHECK: (setlocal @2 (fdiv @1 @0)) -define double @fdiv64(double %x, double %y) { - %a = fdiv double %x, %y - ret double %a -} - -; CHECK-LABEL: (func $fabs64 -; CHECK: (setlocal @1 (fabs @0)) -define double @fabs64(double %x) { - %a = call double @llvm.fabs.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $fneg64 -; CHECK: (setlocal @1 (fneg @0)) -define double @fneg64(double %x) { - %a = fsub double -0., %x - ret double %a -} - -; CHECK-LABEL: (func $copysign64 -; CHECK: (setlocal @2 (copysign @1 @0)) -define double @copysign64(double %x, double %y) { - %a = call double @llvm.copysign.f64(double %x, double %y) - ret double %a -} - -; CHECK-LABEL: (func $sqrt64 -; CHECK: (setlocal @1 (sqrt @0)) -define double @sqrt64(double %x) { - %a = call double @llvm.sqrt.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $ceil64 -; CHECK: (setlocal @1 (ceil @0)) -define double @ceil64(double %x) { - %a = call double @llvm.ceil.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $floor64 -; CHECK: (setlocal @1 (floor @0)) -define double @floor64(double %x) { - %a = call double @llvm.floor.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $trunc64 -; CHECK: (setlocal @1 (trunc @0)) -define double @trunc64(double %x) { - %a = call double @llvm.trunc.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $nearest64 -; CHECK: (setlocal @1 (nearest @0)) -define double @nearest64(double %x) { - %a = call double @llvm.nearbyint.f64(double %x) - ret double %a -} - -; CHECK-LABEL: (func $nearest64_via_rint -; CHECK: (setlocal @1 (nearest @0)) -define double @nearest64_via_rint(double %x) { - %a = call double @llvm.rint.f64(double %x) - ret double %a -} diff --git a/test/CodeGen/WebAssembly/i32.ll b/test/CodeGen/WebAssembly/i32.ll new file mode 100644 index 00000000000..78cf9642448 --- /dev/null +++ b/test/CodeGen/WebAssembly/i32.ll @@ -0,0 +1,203 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that basic 32-bit integer operations assemble as expected. + +target datalayout = "e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +declare i32 @llvm.ctlz.i32(i32, i1) +declare i32 @llvm.cttz.i32(i32, i1) +declare i32 @llvm.ctpop.i32(i32) + +; CHECK-LABEL: (func $add32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (add @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @add32(i32 %x, i32 %y) { + %a = add i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $sub32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (sub @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @sub32(i32 %x, i32 %y) { + %a = sub i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $mul32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (mul @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @mul32(i32 %x, i32 %y) { + %a = mul i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $sdiv32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (sdiv @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @sdiv32(i32 %x, i32 %y) { + %a = sdiv i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $udiv32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (udiv @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @udiv32(i32 %x, i32 %y) { + %a = udiv i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $srem32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (srem @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @srem32(i32 %x, i32 %y) { + %a = srem i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $urem32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (urem @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @urem32(i32 %x, i32 %y) { + %a = urem i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $and32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (and @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @and32(i32 %x, i32 %y) { + %a = and i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $ior32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (ior @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @ior32(i32 %x, i32 %y) { + %a = or i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $xor32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (xor @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @xor32(i32 %x, i32 %y) { + %a = xor i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $shl32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shl @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @shl32(i32 %x, i32 %y) { + %a = shl i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $shr32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shr_u @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @shr32(i32 %x, i32 %y) { + %a = lshr i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $sar32 +; CHECK-NEXT: (param i32) (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shr_s @1 @0)) +; CHECK-NEXT: (return @2) +define i32 @sar32(i32 %x, i32 %y) { + %a = ashr i32 %x, %y + ret i32 %a +} + +; CHECK-LABEL: (func $clz32 +; CHECK-NEXT: (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (clz @0)) +; CHECK-NEXT: (return @1) +define i32 @clz32(i32 %x) { + %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false) + ret i32 %a +} + +; CHECK-LABEL: (func $clz32_zero_undef +; CHECK-NEXT: (param i32) (result i32) +; 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: (func $ctz32 +; CHECK-NEXT: (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (ctz @0)) +; CHECK-NEXT: (return @1) +define i32 @ctz32(i32 %x) { + %a = call i32 @llvm.cttz.i32(i32 %x, i1 false) + ret i32 %a +} + +; CHECK-LABEL: (func $ctz32_zero_undef +; CHECK-NEXT: (param i32) (result i32) +; 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: (func $popcnt32 +; CHECK-NEXT: (param i32) (result i32) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (popcnt @0)) +; CHECK-NEXT: (return @1) +define i32 @popcnt32(i32 %x) { + %a = call i32 @llvm.ctpop.i32(i32 %x) + ret i32 %a +} diff --git a/test/CodeGen/WebAssembly/i64.ll b/test/CodeGen/WebAssembly/i64.ll new file mode 100644 index 00000000000..b1c99c54f61 --- /dev/null +++ b/test/CodeGen/WebAssembly/i64.ll @@ -0,0 +1,203 @@ +; RUN: llc < %s -asm-verbose=false | FileCheck %s + +; Test that basic 64-bit integer operations assemble as expected. + +target datalayout = "e-p:32:32-i64:64-n32:64-S128" +target triple = "wasm32-unknown-unknown" + +declare i64 @llvm.ctlz.i64(i64, i1) +declare i64 @llvm.cttz.i64(i64, i1) +declare i64 @llvm.ctpop.i64(i64) + +; CHECK-LABEL: (func $add64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (add @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @add64(i64 %x, i64 %y) { + %a = add i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $sub64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (sub @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @sub64(i64 %x, i64 %y) { + %a = sub i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $mul64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (mul @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @mul64(i64 %x, i64 %y) { + %a = mul i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $sdiv64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (sdiv @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @sdiv64(i64 %x, i64 %y) { + %a = sdiv i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $udiv64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (udiv @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @udiv64(i64 %x, i64 %y) { + %a = udiv i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $srem64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (srem @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @srem64(i64 %x, i64 %y) { + %a = srem i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $urem64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (urem @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @urem64(i64 %x, i64 %y) { + %a = urem i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $and64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (and @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @and64(i64 %x, i64 %y) { + %a = and i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $ior64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (ior @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @ior64(i64 %x, i64 %y) { + %a = or i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $xor64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (xor @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @xor64(i64 %x, i64 %y) { + %a = xor i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $shl64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shl @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @shl64(i64 %x, i64 %y) { + %a = shl i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $shr64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shr_u @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @shr64(i64 %x, i64 %y) { + %a = lshr i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $sar64 +; CHECK-NEXT: (param i64) (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 1)) +; CHECK-NEXT: (setlocal @1 (argument 0)) +; CHECK-NEXT: (setlocal @2 (shr_s @1 @0)) +; CHECK-NEXT: (return @2) +define i64 @sar64(i64 %x, i64 %y) { + %a = ashr i64 %x, %y + ret i64 %a +} + +; CHECK-LABEL: (func $clz64 +; CHECK-NEXT: (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (clz @0)) +; CHECK-NEXT: (return @1) +define i64 @clz64(i64 %x) { + %a = call i64 @llvm.ctlz.i64(i64 %x, i1 false) + ret i64 %a +} + +; CHECK-LABEL: (func $clz64_zero_undef +; CHECK-NEXT: (param i64) (result i64) +; 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: (func $ctz64 +; CHECK-NEXT: (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (ctz @0)) +; CHECK-NEXT: (return @1) +define i64 @ctz64(i64 %x) { + %a = call i64 @llvm.cttz.i64(i64 %x, i1 false) + ret i64 %a +} + +; CHECK-LABEL: (func $ctz64_zero_undef +; CHECK-NEXT: (param i64) (result i64) +; 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: (func $popcnt64 +; CHECK-NEXT: (param i64) (result i64) +; CHECK-NEXT: (setlocal @0 (argument 0)) +; CHECK-NEXT: (setlocal @1 (popcnt @0)) +; CHECK-NEXT: (return @1) +define i64 @popcnt64(i64 %x) { + %a = call i64 @llvm.ctpop.i64(i64 %x) + ret i64 %a +} diff --git a/test/CodeGen/WebAssembly/integer32.ll b/test/CodeGen/WebAssembly/integer32.ll deleted file mode 100644 index 78cf9642448..00000000000 --- a/test/CodeGen/WebAssembly/integer32.ll +++ /dev/null @@ -1,203 +0,0 @@ -; RUN: llc < %s -asm-verbose=false | FileCheck %s - -; Test that basic 32-bit integer operations assemble as expected. - -target datalayout = "e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" - -declare i32 @llvm.ctlz.i32(i32, i1) -declare i32 @llvm.cttz.i32(i32, i1) -declare i32 @llvm.ctpop.i32(i32) - -; CHECK-LABEL: (func $add32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (add @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @add32(i32 %x, i32 %y) { - %a = add i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $sub32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (sub @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @sub32(i32 %x, i32 %y) { - %a = sub i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $mul32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (mul @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @mul32(i32 %x, i32 %y) { - %a = mul i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $sdiv32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (sdiv @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @sdiv32(i32 %x, i32 %y) { - %a = sdiv i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $udiv32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (udiv @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @udiv32(i32 %x, i32 %y) { - %a = udiv i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $srem32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (srem @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @srem32(i32 %x, i32 %y) { - %a = srem i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $urem32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (urem @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @urem32(i32 %x, i32 %y) { - %a = urem i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $and32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (and @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @and32(i32 %x, i32 %y) { - %a = and i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $ior32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (ior @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @ior32(i32 %x, i32 %y) { - %a = or i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $xor32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (xor @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @xor32(i32 %x, i32 %y) { - %a = xor i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $shl32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shl @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @shl32(i32 %x, i32 %y) { - %a = shl i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $shr32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shr_u @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @shr32(i32 %x, i32 %y) { - %a = lshr i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $sar32 -; CHECK-NEXT: (param i32) (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shr_s @1 @0)) -; CHECK-NEXT: (return @2) -define i32 @sar32(i32 %x, i32 %y) { - %a = ashr i32 %x, %y - ret i32 %a -} - -; CHECK-LABEL: (func $clz32 -; CHECK-NEXT: (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (clz @0)) -; CHECK-NEXT: (return @1) -define i32 @clz32(i32 %x) { - %a = call i32 @llvm.ctlz.i32(i32 %x, i1 false) - ret i32 %a -} - -; CHECK-LABEL: (func $clz32_zero_undef -; CHECK-NEXT: (param i32) (result i32) -; 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: (func $ctz32 -; CHECK-NEXT: (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (ctz @0)) -; CHECK-NEXT: (return @1) -define i32 @ctz32(i32 %x) { - %a = call i32 @llvm.cttz.i32(i32 %x, i1 false) - ret i32 %a -} - -; CHECK-LABEL: (func $ctz32_zero_undef -; CHECK-NEXT: (param i32) (result i32) -; 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: (func $popcnt32 -; CHECK-NEXT: (param i32) (result i32) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (popcnt @0)) -; CHECK-NEXT: (return @1) -define i32 @popcnt32(i32 %x) { - %a = call i32 @llvm.ctpop.i32(i32 %x) - ret i32 %a -} diff --git a/test/CodeGen/WebAssembly/integer64.ll b/test/CodeGen/WebAssembly/integer64.ll deleted file mode 100644 index b1c99c54f61..00000000000 --- a/test/CodeGen/WebAssembly/integer64.ll +++ /dev/null @@ -1,203 +0,0 @@ -; RUN: llc < %s -asm-verbose=false | FileCheck %s - -; Test that basic 64-bit integer operations assemble as expected. - -target datalayout = "e-p:32:32-i64:64-n32:64-S128" -target triple = "wasm32-unknown-unknown" - -declare i64 @llvm.ctlz.i64(i64, i1) -declare i64 @llvm.cttz.i64(i64, i1) -declare i64 @llvm.ctpop.i64(i64) - -; CHECK-LABEL: (func $add64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (add @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @add64(i64 %x, i64 %y) { - %a = add i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $sub64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (sub @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @sub64(i64 %x, i64 %y) { - %a = sub i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $mul64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (mul @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @mul64(i64 %x, i64 %y) { - %a = mul i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $sdiv64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (sdiv @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @sdiv64(i64 %x, i64 %y) { - %a = sdiv i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $udiv64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (udiv @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @udiv64(i64 %x, i64 %y) { - %a = udiv i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $srem64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (srem @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @srem64(i64 %x, i64 %y) { - %a = srem i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $urem64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (urem @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @urem64(i64 %x, i64 %y) { - %a = urem i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $and64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (and @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @and64(i64 %x, i64 %y) { - %a = and i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $ior64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (ior @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @ior64(i64 %x, i64 %y) { - %a = or i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $xor64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (xor @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @xor64(i64 %x, i64 %y) { - %a = xor i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $shl64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shl @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @shl64(i64 %x, i64 %y) { - %a = shl i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $shr64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shr_u @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @shr64(i64 %x, i64 %y) { - %a = lshr i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $sar64 -; CHECK-NEXT: (param i64) (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 1)) -; CHECK-NEXT: (setlocal @1 (argument 0)) -; CHECK-NEXT: (setlocal @2 (shr_s @1 @0)) -; CHECK-NEXT: (return @2) -define i64 @sar64(i64 %x, i64 %y) { - %a = ashr i64 %x, %y - ret i64 %a -} - -; CHECK-LABEL: (func $clz64 -; CHECK-NEXT: (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (clz @0)) -; CHECK-NEXT: (return @1) -define i64 @clz64(i64 %x) { - %a = call i64 @llvm.ctlz.i64(i64 %x, i1 false) - ret i64 %a -} - -; CHECK-LABEL: (func $clz64_zero_undef -; CHECK-NEXT: (param i64) (result i64) -; 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: (func $ctz64 -; CHECK-NEXT: (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (ctz @0)) -; CHECK-NEXT: (return @1) -define i64 @ctz64(i64 %x) { - %a = call i64 @llvm.cttz.i64(i64 %x, i1 false) - ret i64 %a -} - -; CHECK-LABEL: (func $ctz64_zero_undef -; CHECK-NEXT: (param i64) (result i64) -; 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: (func $popcnt64 -; CHECK-NEXT: (param i64) (result i64) -; CHECK-NEXT: (setlocal @0 (argument 0)) -; CHECK-NEXT: (setlocal @1 (popcnt @0)) -; CHECK-NEXT: (return @1) -define i64 @popcnt64(i64 %x) { - %a = call i64 @llvm.ctpop.i64(i64 %x) - ret i64 %a -}