Skip to content

Commit

Permalink
[CIR][CIRGen][Builtin][Neon] Lower vabsh_f16 (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper authored Jan 9, 2025
1 parent 6df2cab commit 6e24255
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
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

0 comments on commit 6e24255

Please sign in to comment.