Skip to content

Commit

Permalink
[RISCV] Add missing test for ctz_32 on RV64
Browse files Browse the repository at this point in the history
Apparently, both of clz and ctz should have tests for _32 version on RV64.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D150945
  • Loading branch information
tclin914 committed May 22, 2023
1 parent f58d2cc commit 33d3d51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clang/test/CodeGen/RISCV/rvb-intrinsics/riscv64-zbb.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ long clz_64(long a) {
return __builtin_riscv_clz_64(a);
}

// RV64ZBB-LABEL: @ctz_32(
// RV64ZBB-NEXT: entry:
// RV64ZBB-NEXT: [[A_ADDR:%.*]] = alloca i32, align 4
// RV64ZBB-NEXT: store i32 [[A:%.*]], ptr [[A_ADDR]], align 4
// RV64ZBB-NEXT: [[TMP0:%.*]] = load i32, ptr [[A_ADDR]], align 4
// RV64ZBB-NEXT: [[TMP1:%.*]] = call i32 @llvm.cttz.i32(i32 [[TMP0]], i1 false)
// RV64ZBB-NEXT: ret i32 [[TMP1]]
//
int ctz_32(int a) {
return __builtin_riscv_ctz_32(a);
}

// RV64ZBB-LABEL: @ctz_64(
// RV64ZBB-NEXT: entry:
// RV64ZBB-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8
Expand Down

0 comments on commit 33d3d51

Please sign in to comment.