Skip to content

Commit 1087cbb

Browse files
FantasqueXlanza
authored andcommitted
[CIR][CIRGen][Neon] Make vrnda emit RoundOp directly (llvm#1453)
Similar PR: llvm/clangir#1434
1 parent 7dba317 commit 1087cbb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,8 +4135,8 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
41354135
case NEON::BI__builtin_neon_vrnda_v:
41364136
case NEON::BI__builtin_neon_vrndaq_v: {
41374137
assert(!cir::MissingFeatures::emitConstrainedFPCall());
4138-
return emitNeonCall(builder, {ty}, Ops, "round", ty,
4139-
getLoc(E->getExprLoc()));
4138+
return emitNeonCallToOp<cir::RoundOp>(builder, {ty}, Ops, std::nullopt, ty,
4139+
getLoc(E->getExprLoc()));
41404140
}
41414141
case NEON::BI__builtin_neon_vrndih_f16: {
41424142
llvm_unreachable("NEON::BI__builtin_neon_vrndih_f16 NYI");

clang/test/CIR/CodeGen/AArch64/neon-arith.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ float32x2_t test_vrnda_f32(float32x2_t a) {
4848
// CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 2>>, !cir.vector<!cir.float x 2>
4949
// CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 2>), !cir.vector<!s8i x 8>
5050
// CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 8>), !cir.vector<!cir.float x 2>
51-
// CIR: {{%.*}} = cir.llvm.intrinsic "round" [[INTRIN_ARG_BACK]] : (!cir.vector<!cir.float x 2>) -> !cir.vector<!cir.float x 2>
51+
// CIR: {{%.*}} = cir.round [[INTRIN_ARG_BACK]] : !cir.vector<!cir.float x 2>
5252
// CIR: cir.return {{%.*}} : !cir.vector<!cir.float x 2>
5353

5454
// CIR-LABEL: test_vrnda_f32
@@ -72,7 +72,7 @@ float32x4_t test_vrndaq_f32(float32x4_t a) {
7272
// CIR: [[INTRIN_ARG:%.*]] = cir.load [[ARG_SAVE]] : !cir.ptr<!cir.vector<!cir.float x 4>>, !cir.vector<!cir.float x 4>
7373
// CIR: [[INTRIN_ARG_CAST:%.*]] = cir.cast(bitcast, [[INTRIN_ARG]] : !cir.vector<!cir.float x 4>), !cir.vector<!s8i x 16>
7474
// CIR: [[INTRIN_ARG_BACK:%.*]] = cir.cast(bitcast, [[INTRIN_ARG_CAST]] : !cir.vector<!s8i x 16>), !cir.vector<!cir.float x 4>
75-
// CIR: {{%.*}} = cir.llvm.intrinsic "round" [[INTRIN_ARG_BACK]] : (!cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
75+
// CIR: {{%.*}} = cir.round [[INTRIN_ARG_BACK]] : !cir.vector<!cir.float x 4>
7676
// CIR: cir.return {{%.*}} : !cir.vector<!cir.float x 4>
7777

7878
// LLVM: {{.*}}test_vrndaq_f32(<4 x float>{{.*}}[[ARG:%.*]])

0 commit comments

Comments
 (0)