xref: /llvm-project/llvm/test/Transforms/CodeGenPrepare/RISCV/cttz-ctlz.ll (revision f1ec0d12bb0843f0deab83ef2b5cf1339cbc4f0b)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
3
4target triple = "riscv64-unknown-unknown"
5
6; Check that despeculating count-zeros intrinsics doesn't crash when those
7; intrinsics use scalable types.
8
9define <vscale x 4 x i64> @cttz_nxv4i64(<vscale x 4 x i64> %x) {
10; CHECK-LABEL: @cttz_nxv4i64(
11; CHECK-NEXT:    [[Z:%.*]] = call <vscale x 4 x i64> @llvm.cttz.nxv4i64(<vscale x 4 x i64> [[X:%.*]], i1 false)
12; CHECK-NEXT:    ret <vscale x 4 x i64> [[Z]]
13;
14  %z = call <vscale x 4 x i64> @llvm.cttz.nxv4i64(<vscale x 4 x i64> %x, i1 false)
15  ret <vscale x 4 x i64> %z
16}
17
18define <vscale x 4 x i64> @ctlz_nxv4i64(<vscale x 4 x i64> %x) {
19; CHECK-LABEL: @ctlz_nxv4i64(
20; CHECK-NEXT:    [[Z:%.*]] = call <vscale x 4 x i64> @llvm.ctlz.nxv4i64(<vscale x 4 x i64> [[X:%.*]], i1 false)
21; CHECK-NEXT:    ret <vscale x 4 x i64> [[Z]]
22;
23  %z = call <vscale x 4 x i64> @llvm.ctlz.nxv4i64(<vscale x 4 x i64> %x, i1 false)
24  ret <vscale x 4 x i64> %z
25}
26
27declare <vscale x 4 x i64> @llvm.cttz.nxv4i64(<vscale x 4 x i64>, i1)
28declare <vscale x 4 x i64> @llvm.ctlz.nxv4i64(<vscale x 4 x i64>, i1)
29