Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SveEmitter] Add immediate checks for lanes and complex imms
Adds another bunch of of intrinsics that take immediates with varying ranges based, some being a complex rotation immediate which are a set of allowed immediates rather than a range. svmla_lane: lane immediate ranging 0..(128/(1*sizeinbits(elt)) - 1) svcmla_lane: lane immediate ranging 0..(128/(2*sizeinbits(elt)) - 1) svdot_lane: lane immediate ranging 0..(128/(4*sizeinbits(elt)) - 1) svcadd: complex rotate immediate [90, 270] svcmla: svcmla_lane: complex rotate immediate [0, 90, 180, 270] Reviewers: efriedma, SjoerdMeijer, rovka Reviewed By: efriedma Tags: #clang Differential Revision: https://reviews.llvm.org/D76680
- Loading branch information
1 parent
a8a31fd
commit fc64539
Showing
11 changed files
with
483 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
|
||
#include <arm_sve.h> | ||
|
||
#ifdef SVE_OVERLOADED_FORMS | ||
// A simple used,unused... macro, long enough to represent any SVE builtin. | ||
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 | ||
#else | ||
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 | ||
#endif | ||
|
||
svfloat16_t test_svcmla_f16_m(svbool_t pg, svfloat16_t op1, svfloat16_t op2, svfloat16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_f16_m | ||
// CHECK: %[[PG:.*]] = call <vscale x 8 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv8i1(<vscale x 16 x i1> %pg) | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fcmla.nxv8f16(<vscale x 8 x i1> %[[PG]], <vscale x 8 x half> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 180) | ||
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla,_f16,_m,)(pg, op1, op2, op3, 180); | ||
} | ||
|
||
svfloat32_t test_svcmla_f32_m(svbool_t pg, svfloat32_t op1, svfloat32_t op2, svfloat32_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_f32_m | ||
// CHECK: %[[PG:.*]] = call <vscale x 4 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv4i1(<vscale x 16 x i1> %pg) | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fcmla.nxv4f32(<vscale x 4 x i1> %[[PG]], <vscale x 4 x float> %op1, <vscale x 4 x float> %op2, <vscale x 4 x float> %op3, i32 270) | ||
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla,_f32,_m,)(pg, op1, op2, op3, 270); | ||
} | ||
|
||
svfloat64_t test_svcmla_f64_m(svbool_t pg, svfloat64_t op1, svfloat64_t op2, svfloat64_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_f64_m | ||
// CHECK: %[[PG:.*]] = call <vscale x 2 x i1> @llvm.aarch64.sve.convert.from.svbool.nxv2i1(<vscale x 16 x i1> %pg) | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fcmla.nxv2f64(<vscale x 2 x i1> %[[PG]], <vscale x 2 x double> %op1, <vscale x 2 x double> %op2, <vscale x 2 x double> %op3, i32 0) | ||
// CHECK: ret <vscale x 2 x double> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla,_f64,_m,)(pg, op1, op2, op3, 0); | ||
} | ||
|
||
svfloat16_t test_svcmla_lane_f16(svfloat16_t op1, svfloat16_t op2, svfloat16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_lane_f16 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fcmla.lane.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0, i32 0) | ||
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla_lane,_f16,,)(op1, op2, op3, 0, 0); | ||
} | ||
|
||
svfloat16_t test_svcmla_lane_f16_1(svfloat16_t op1, svfloat16_t op2, svfloat16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_lane_f16_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fcmla.lane.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 3, i32 90) | ||
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla_lane,_f16,,)(op1, op2, op3, 3, 90); | ||
} | ||
|
||
svfloat32_t test_svcmla_lane_f32(svfloat32_t op1, svfloat32_t op2, svfloat32_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_lane_f32 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fcmla.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2, <vscale x 4 x float> %op3, i32 0, i32 180) | ||
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla_lane,_f32,,)(op1, op2, op3, 0, 180); | ||
} | ||
|
||
svfloat32_t test_svcmla_lane_f32_1(svfloat32_t op1, svfloat32_t op2, svfloat32_t op3) | ||
{ | ||
// CHECK-LABEL: test_svcmla_lane_f32_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fcmla.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2, <vscale x 4 x float> %op3, i32 1, i32 270) | ||
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svcmla_lane,_f32,,)(op1, op2, op3, 1, 270); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
|
||
#include <arm_sve.h> | ||
|
||
#ifdef SVE_OVERLOADED_FORMS | ||
// A simple used,unused... macro, long enough to represent any SVE builtin. | ||
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 | ||
#else | ||
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 | ||
#endif | ||
|
||
svint32_t test_svdot_lane_s32(svint32_t op1, svint8_t op2, svint8_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_s32 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 0) | ||
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_s32,,)(op1, op2, op3, 0); | ||
} | ||
|
||
svint32_t test_svdot_lane_s32_1(svint32_t op1, svint8_t op2, svint8_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_s32_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.sdot.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 3) | ||
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_s32,,)(op1, op2, op3, 3); | ||
} | ||
|
||
svint64_t test_svdot_lane_s64(svint64_t op1, svint16_t op2, svint16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_s64 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 0) | ||
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_s64,,)(op1, op2, op3, 0); | ||
} | ||
|
||
svint64_t test_svdot_lane_s64_1(svint64_t op1, svint16_t op2, svint16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_s64_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.sdot.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 1) | ||
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_s64,,)(op1, op2, op3, 1); | ||
} | ||
|
||
svuint32_t test_svdot_lane_u32(svuint32_t op1, svuint8_t op2, svuint8_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_u32 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x i32> @llvm.aarch64.sve.udot.lane.nxv4i32(<vscale x 4 x i32> %op1, <vscale x 16 x i8> %op2, <vscale x 16 x i8> %op3, i32 3) | ||
// CHECK: ret <vscale x 4 x i32> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_u32,,)(op1, op2, op3, 3); | ||
} | ||
|
||
svuint64_t test_svdot_lane_u64(svuint64_t op1, svuint16_t op2, svuint16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svdot_lane_u64 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x i64> @llvm.aarch64.sve.udot.lane.nxv2i64(<vscale x 2 x i64> %op1, <vscale x 8 x i16> %op2, <vscale x 8 x i16> %op3, i32 1) | ||
// CHECK: ret <vscale x 2 x i64> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svdot_lane,_u64,,)(op1, op2, op3, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s | ||
|
||
#include <arm_sve.h> | ||
|
||
#ifdef SVE_OVERLOADED_FORMS | ||
// A simple used,unused... macro, long enough to represent any SVE builtin. | ||
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 | ||
#else | ||
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 | ||
#endif | ||
|
||
svfloat16_t test_svmla_lane_f16(svfloat16_t op1, svfloat16_t op2, svfloat16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f16 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fmla.lane.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 0) | ||
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f16,,)(op1, op2, op3, 0); | ||
} | ||
|
||
svfloat16_t test_svmla_lane_f16_1(svfloat16_t op1, svfloat16_t op2, svfloat16_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f16_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 8 x half> @llvm.aarch64.sve.fmla.lane.nxv8f16(<vscale x 8 x half> %op1, <vscale x 8 x half> %op2, <vscale x 8 x half> %op3, i32 7) | ||
// CHECK: ret <vscale x 8 x half> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f16,,)(op1, op2, op3, 7); | ||
} | ||
|
||
svfloat32_t test_svmla_lane_f32(svfloat32_t op1, svfloat32_t op2, svfloat32_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f32 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmla.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2, <vscale x 4 x float> %op3, i32 0) | ||
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f32,,)(op1, op2, op3, 0); | ||
} | ||
|
||
svfloat32_t test_svmla_lane_f32_1(svfloat32_t op1, svfloat32_t op2, svfloat32_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f32_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 4 x float> @llvm.aarch64.sve.fmla.lane.nxv4f32(<vscale x 4 x float> %op1, <vscale x 4 x float> %op2, <vscale x 4 x float> %op3, i32 3) | ||
// CHECK: ret <vscale x 4 x float> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f32,,)(op1, op2, op3, 3); | ||
} | ||
|
||
svfloat64_t test_svmla_lane_f64(svfloat64_t op1, svfloat64_t op2, svfloat64_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f64 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fmla.lane.nxv2f64(<vscale x 2 x double> %op1, <vscale x 2 x double> %op2, <vscale x 2 x double> %op3, i32 0) | ||
// CHECK: ret <vscale x 2 x double> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f64,,)(op1, op2, op3, 0); | ||
} | ||
|
||
svfloat64_t test_svmla_lane_f64_1(svfloat64_t op1, svfloat64_t op2, svfloat64_t op3) | ||
{ | ||
// CHECK-LABEL: test_svmla_lane_f64_1 | ||
// CHECK: %[[INTRINSIC:.*]] = call <vscale x 2 x double> @llvm.aarch64.sve.fmla.lane.nxv2f64(<vscale x 2 x double> %op1, <vscale x 2 x double> %op2, <vscale x 2 x double> %op3, i32 1) | ||
// CHECK: ret <vscale x 2 x double> %[[INTRINSIC]] | ||
return SVE_ACLE_FUNC(svmla_lane,_f64,,)(op1, op2, op3, 1); | ||
} |
29 changes: 29 additions & 0 deletions
29
clang/test/CodeGen/aarch64-sve-intrinsics/negative/acle_sve_cadd.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s | ||
// RUN: %clang_cc1 -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -fallow-half-arguments-and-returns -fsyntax-only -verify %s | ||
|
||
#ifdef SVE_OVERLOADED_FORMS | ||
// A simple used,unused... macro, long enough to represent any SVE builtin. | ||
#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 | ||
#else | ||
#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 | ||
#endif | ||
|
||
#include <arm_sve.h> | ||
|
||
svfloat16_t test_svcadd_f16_m(svbool_t pg, svfloat16_t op1, svfloat16_t op2) | ||
{ | ||
// expected-error@+1 {{argument should be the value 90 or 270}} | ||
return SVE_ACLE_FUNC(svcadd,_f16,_m,)(pg, op1, op2, 0); | ||
} | ||
|
||
svfloat32_t test_svcadd_f32_m(svbool_t pg, svfloat32_t op1, svfloat32_t op2) | ||
{ | ||
// expected-error@+1 {{argument should be the value 90 or 270}} | ||
return SVE_ACLE_FUNC(svcadd,_f32,_m,)(pg, op1, op2, 0); | ||
} | ||
|
||
svfloat64_t test_svcadd_f64_m(svbool_t pg, svfloat64_t op1, svfloat64_t op2) | ||
{ | ||
// expected-error@+1 {{argument should be the value 90 or 270}} | ||
return SVE_ACLE_FUNC(svcadd,_f64,_m,)(pg, op1, op2, 0); | ||
} |
Oops, something went wrong.