[Hexagon] Use __HVX_IEEE_FP__ to guard protos that need -mhvx-ieee-fp (#184422)

Hexagon clang recently started to define __HVX_IEEE_FP__ when the
-mhvx-ieee-fp option is specified. Guard the intrinsic macros for
instructions that should only be available with -mhvx-ieee-fp with
__HVX_IEEE_FP__.

Additionally, the following NFC changes are included:

- NFC: Remove guards around HVX v60 intrinsic macros
  Hexagon v60 is the oldest Hexagon version that supports HVX so these
  guards were redundant. Presence of HVX is guarded separately, once
  per the whole file.

- Remove comments from closing guards (HVX protos)
  These comments served very limited function as they only guard
  one macro. Also, they were incorrect. Instead of fixing remove them.
  This will also reduce by the factor of two the amount of changes
  when guarding conditions change.
This commit is contained in:
Alexey Karyakin 2026-03-04 10:30:34 -05:00 committed by GitHub
parent f55080da98
commit e8e8d30b22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 307 additions and 891 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
// REQUIRES: hexagon-registered-target
// RUN: %clang_cc1 -internal-isystem %S/../../lib/Headers/ \
// RUN: -triple hexagon-unknown-elf -target-cpu hexagonv68 \
// RUN: -target-feature +hvx-length128b -target-feature +hvxv68 \
// RUN: -target-feature +hvx-ieee-fp -emit-llvm %s -o - | FileCheck %s
// RUN: not %clang_cc1 -internal-isystem %S/../../lib/Headers/ \
// RUN: -triple hexagon-unknown-elf -target-cpu hexagonv68 \
// RUN: -target-feature +hvx-length128b -target-feature +hvxv68 \
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-ERR %s
#include <hvx_hexagon_protos.h>
#include <hexagon_types.h>
HVX_Vector f(HVX_Vector v) {
// CHECK-ERR: error: call to undeclared function 'Q6_Vhf_vabs_Vhf'
// CHECK: call <32 x i32> @llvm.hexagon.V6.vabs.hf.128B
return Q6_Vhf_vabs_Vhf(v);
}