forked from OSchip/llvm-project
[AArch64] Check target feature support for __builtin_arm_crc*
This is the AArch64 counterpart of D134127. Daniel Kiss will change more `BUILTIN` to `TARGET_BUILTIN`. Fix #57802
This commit is contained in:
parent
9a1544277e
commit
b2d7a0dcf1
|
@ -17,6 +17,10 @@
|
|||
# define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
|
||||
#endif
|
||||
|
||||
#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
|
||||
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
|
||||
#endif
|
||||
|
||||
#if defined(BUILTIN) && !defined(TARGET_HEADER_BUILTIN)
|
||||
# define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
|
||||
#endif
|
||||
|
@ -45,14 +49,14 @@ BUILTIN(__builtin_arm_sev, "v", "")
|
|||
BUILTIN(__builtin_arm_sevl, "v", "")
|
||||
|
||||
// CRC32
|
||||
BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc")
|
||||
BUILTIN(__builtin_arm_crc32cb, "UiUiUc", "nc")
|
||||
BUILTIN(__builtin_arm_crc32h, "UiUiUs", "nc")
|
||||
BUILTIN(__builtin_arm_crc32ch, "UiUiUs", "nc")
|
||||
BUILTIN(__builtin_arm_crc32w, "UiUiUi", "nc")
|
||||
BUILTIN(__builtin_arm_crc32cw, "UiUiUi", "nc")
|
||||
BUILTIN(__builtin_arm_crc32d, "UiUiWUi", "nc")
|
||||
BUILTIN(__builtin_arm_crc32cd, "UiUiWUi", "nc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32b, "UiUiUc", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32cb, "UiUiUc", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32h, "UiUiUs", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32ch, "UiUiUs", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32w, "UiUiUi", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32cw, "UiUiUi", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32d, "UiUiWUi", "nc", "crc")
|
||||
TARGET_BUILTIN(__builtin_arm_crc32cd, "UiUiWUi", "nc", "crc")
|
||||
|
||||
// Memory Tagging Extensions (MTE)
|
||||
BUILTIN(__builtin_arm_irg, "v*v*Ui", "t")
|
||||
|
|
|
@ -35,6 +35,8 @@ const Builtin::Info AArch64TargetInfo::BuiltinInfo[] = {
|
|||
{#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
|
||||
#define LANGBUILTIN(ID, TYPE, ATTRS, LANG) \
|
||||
{#ID, TYPE, ATTRS, nullptr, LANG, nullptr},
|
||||
#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \
|
||||
{#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, FEATURE},
|
||||
#define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \
|
||||
{#ID, TYPE, ATTRS, HEADER, LANGS, FEATURE},
|
||||
#include "clang/Basic/BuiltinsAArch64.def"
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
// REQUIRES: aarch64-registered-target
|
||||
// RUN: %clang_cc1 -triple arm64-none-linux-gnu \
|
||||
// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +crc \
|
||||
// RUN: -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
|
||||
// RUN: %clang_cc1 -triple aarch64-windows \
|
||||
// RUN: %clang_cc1 -triple aarch64-windows -target-feature +crc \
|
||||
// RUN: -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -emit-llvm-only -triple aarch64 -target-feature -crc %s
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t crc32b(uint32_t a, uint8_t b)
|
||||
{
|
||||
// expected-error@+1 {{'__builtin_arm_crc32b' needs target feature crc}}
|
||||
return __builtin_arm_crc32b(a,b);
|
||||
// CHECK: [[T0:%[0-9]+]] = zext i8 %b to i32
|
||||
// CHECK: call i32 @llvm.aarch64.crc32b(i32 %a, i32 [[T0]])
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple armv8a-none-eabi -target-feature +crc -target-feature +dsp -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch32
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -Wno-error=implicit-function-declaration -triple aarch64-none-eabi -target-feature +neon -target-feature +crc -target-feature +crypto -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.3a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.5a -target-feature +rand -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483,AArch6485
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.3a -target-feature +crc -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483
|
||||
// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.5a -target-feature +crc -target-feature +rand -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483,AArch6485
|
||||
|
||||
#include <arm_acle.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue