Skip to content

[CIR][CIRGen][Builtin][Neon] Lower vabsh_f16 #1269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3554,8 +3554,10 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
switch (BuiltinID) {
default:
break;
case NEON::BI__builtin_neon_vabsh_f16:
llvm_unreachable("NEON::BI__builtin_neon_vabsh_f16 NYI");
case NEON::BI__builtin_neon_vabsh_f16: {
Ops.push_back(emitScalarExpr(E->getArg(0)));
return builder.create<cir::FAbsOp>(getLoc(E->getExprLoc()), Ops);
}
case NEON::BI__builtin_neon_vaddq_p128: {
llvm_unreachable("NEON::BI__builtin_neon_vaddq_p128 NYI");
}
Expand Down
16 changes: 10 additions & 6 deletions clang/test/CIR/CodeGen/AArch64/neon-fp16.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@

#include <arm_fp16.h>

// NYI-LABEL: test_vabsh_f16
// NYI: [[ABS:%.*]] = call half @llvm.fabs.f16(half %a)
// NYI: ret half [[ABS]]
// float16_t test_vabsh_f16(float16_t a) {
// return vabsh_f16(a);
// }
// CIR-LABEL: vabsh_f16
// CIR: {{%.*}} = cir.fabs {{%.*}} : !cir.f16
//
// LLVM-LABEL: test_vabsh_f16
// LLVM-SAME: (half [[a:%.]])
// LLVM: [[ABS:%.*]] = call half @llvm.fabs.f16(half [[a]])
// LLVM: ret half [[ABS]]
float16_t test_vabsh_f16(float16_t a) {
return vabsh_f16(a);
}

// NYI-LABEL: test_vceqzh_f16
// NYI: [[TMP1:%.*]] = fcmp oeq half %a, 0xH0000
Expand Down
Loading