[PATCH] D82399: [AArch64][SVE2] Add bfloat16 support to whilerw/whilewr intrinsics
This revision was automatically updated to reflect the committed changes. Closed by commit rG05e10ee0aee0: [AArch64][SVE2] Add bfloat16 support to whilerw/whilewr intrinsics (authored by c-rhodes). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82399/new/ https://reviews.llvm.org/D82399 Files: clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilerw-bfloat.c clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll === --- llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll +++ llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll @@ -36,6 +36,14 @@ ret %out } +define @whilerw_bfloat(bfloat* %a, bfloat* %b) { +; CHECK-LABEL: whilerw_bfloat: +; CHECK: whilerw p0.h, x0, x1 +; CHECK-NEXT: ret + %out = call @llvm.aarch64.sve.whilerw.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) + ret %out +} + define @whilerw_half(half* %a, half* %b) { ; CHECK-LABEL: whilerw_half: ; CHECK: whilerw p0.h, x0, x1 @@ -96,6 +104,14 @@ ret %out } +define @whilewr_bfloat(bfloat* %a, bfloat* %b) { +; CHECK-LABEL: whilewr_bfloat: +; CHECK: whilewr p0.h, x0, x1 +; CHECK-NEXT: ret + %out = call @llvm.aarch64.sve.whilewr.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) + ret %out +} + define @whilewr_half(half* %a, half* %b) { ; CHECK-LABEL: whilewr_half: ; CHECK: whilewr p0.h, x0, x1 @@ -125,6 +141,7 @@ declare @llvm.aarch64.sve.whilerw.s.nx4i1(i32* %a, i32* %b) declare @llvm.aarch64.sve.whilerw.d.nx2i1(i64* %a, i64* %b) +declare @llvm.aarch64.sve.whilerw.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) declare @llvm.aarch64.sve.whilerw.h.nx8i1.f16.f16(half* %a, half* %b) declare @llvm.aarch64.sve.whilerw.s.nx4i1.f32.f32(float* %a, float* %b) declare @llvm.aarch64.sve.whilerw.d.nx2i1.f64.f64(double* %a, double* %b) @@ -134,6 +151,7 @@ declare @llvm.aarch64.sve.whilewr.s.nx4i1(i32* %a, i32* %b) declare @llvm.aarch64.sve.whilewr.d.nx2i1(i64* %a, i64* %b) +declare @llvm.aarch64.sve.whilewr.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) declare @llvm.aarch64.sve.whilewr.h.nx8i1.f16.f16(half* %a, half* %b) declare @llvm.aarch64.sve.whilewr.s.nx4i1.f32.f32(float* %a, float* %b) declare @llvm.aarch64.sve.whilewr.d.nx2i1.f64.f64(double* %a, double* %b) Index: clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s + +// Test expected warnings for implicit declaration when +sve2 is missing +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s + +// Test expected warnings for implicit declaration when +bf16 is missing +// NOTE: +bf16 doesn't currently imply __ARM_FEATURE_SVE_BF16, once the +// implementation is complete it will, at which point -target-feature +bf16 +// should be removed. +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s + +// Test expected ambiguous call error for overloaded form when +bf16 is missing +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify=overload-bf16
[PATCH] D82399: [AArch64][SVE2] Add bfloat16 support to whilerw/whilewr intrinsics
c-rhodes created this revision. c-rhodes added reviewers: sdesmalen, efriedma, kmclaughlin, david-arm, fpetrogalli, stuij. Herald added subscribers: danielkiss, kristof.beyls, tschuett. Herald added projects: clang, LLVM. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D82399 Files: clang/include/clang/Basic/arm_sve.td clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilerw-bfloat.c clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll Index: llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll === --- llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll +++ llvm/test/CodeGen/AArch64/sve2-intrinsics-contiguous-conflict-detection.ll @@ -36,6 +36,14 @@ ret %out } +define @whilerw_bfloat(bfloat* %a, bfloat* %b) { +; CHECK-LABEL: whilerw_bfloat: +; CHECK: whilerw p0.h, x0, x1 +; CHECK-NEXT: ret + %out = call @llvm.aarch64.sve.whilerw.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) + ret %out +} + define @whilerw_half(half* %a, half* %b) { ; CHECK-LABEL: whilerw_half: ; CHECK: whilerw p0.h, x0, x1 @@ -96,6 +104,14 @@ ret %out } +define @whilewr_bfloat(bfloat* %a, bfloat* %b) { +; CHECK-LABEL: whilewr_bfloat: +; CHECK: whilewr p0.h, x0, x1 +; CHECK-NEXT: ret + %out = call @llvm.aarch64.sve.whilewr.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) + ret %out +} + define @whilewr_half(half* %a, half* %b) { ; CHECK-LABEL: whilewr_half: ; CHECK: whilewr p0.h, x0, x1 @@ -125,6 +141,7 @@ declare @llvm.aarch64.sve.whilerw.s.nx4i1(i32* %a, i32* %b) declare @llvm.aarch64.sve.whilerw.d.nx2i1(i64* %a, i64* %b) +declare @llvm.aarch64.sve.whilerw.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) declare @llvm.aarch64.sve.whilerw.h.nx8i1.f16.f16(half* %a, half* %b) declare @llvm.aarch64.sve.whilerw.s.nx4i1.f32.f32(float* %a, float* %b) declare @llvm.aarch64.sve.whilerw.d.nx2i1.f64.f64(double* %a, double* %b) @@ -134,6 +151,7 @@ declare @llvm.aarch64.sve.whilewr.s.nx4i1(i32* %a, i32* %b) declare @llvm.aarch64.sve.whilewr.d.nx2i1(i64* %a, i64* %b) +declare @llvm.aarch64.sve.whilewr.h.nx8i1.bf16.bf16(bfloat* %a, bfloat* %b) declare @llvm.aarch64.sve.whilewr.h.nx8i1.f16.f16(half* %a, half* %b) declare @llvm.aarch64.sve.whilewr.s.nx4i1.f32.f32(float* %a, float* %b) declare @llvm.aarch64.sve.whilewr.d.nx2i1.f64.f64(double* %a, double* %b) Index: clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c === --- /dev/null +++ clang/test/CodeGen/aarch64-sve2-intrinsics/acle_sve2_whilewr-bfloat.c @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s + +// Test expected warnings for implicit declaration when +sve2 is missing +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE_BF16 -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify=overload -verify-ignore-unexpected=error %s + +// Test expected warnings for implicit declaration when +bf16 is missing +// NOTE: +bf16 doesn't currently imply __ARM_FEATURE_SVE_BF16, once the +// implementation is complete it will, at which point -target-feature +bf16 +// should be removed. +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify -verify-ignore-unexpected=error %s + +// Test expected ambiguous call error for overloaded form when +bf16 is missing +// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -D__ARM_FEATURE_SVE2 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve2 -target-feature +bf16 -fallow-half-arguments-and-returns -fsyntax-only -verify=overload-bf16 -verify-ignore-unexpected=note %s + +#include + +#ifdef