Skip to content

Commit f3ff95f

Browse files
committed
[CIR][CIRGen][Neon] Make vrnda emit RoundOp directly
1 parent 52fd4a2 commit f3ff95f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

+2-2
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

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

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

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

0 commit comments

Comments
 (0)