Skip to content

Commit b008d66

Browse files
authored
[Clang][SME2] Add single and multi min and max builtins (#71688)
Adds the following SME2 builtins: svmin_single_(s8|s16|s32|s64)_x(2|4) svmin_single_(u8|u16|u32|u64)_x(2|4) svmin_single_(f16|f32|f64)_x(2|4) svmin_(s8|s16|s32|s64)_x(2|4) svmin_(u8|u16|u32|u64)_x(2|4) svmin_(f16|f32|f64)_x(2|4) svmax_single_(s8|s16|s32|s64)_x(2|4) svmax_single_(u8|u16|u32|u64)_x(2|4) svmax_single_(f16|f32|f64)_x(2|4) svmax_(s8|s16|s32|s64)_x(2|4) svmax_(u8|u16|u32|u64)_x(2|4) svmax_(f16|f32|f64)_x(2|4) See [https://github.com/ARM-software/acle/pull/217](https://github.com/ARM-software/acle/pull/217) Patch by: Kerry McLaughlin <[email protected]>
1 parent 28ace78 commit b008d66

File tree

3 files changed

+3144
-0
lines changed

3 files changed

+3144
-0
lines changed

clang/include/clang/Basic/arm_sve.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,26 @@ defm SVREVD : SInstZPZ<"svrevd", "csilUcUsUiUl", "aarch64_sve_revd">;
19871987
// SME intrinsics which operate only on vectors and do not require ZA should be added here,
19881988
// as they could possibly become SVE instructions in the future.
19891989

1990+
multiclass MinMaxIntr<string i, string zm, string mul, string t> {
1991+
def SVS # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "csil", MergeNone, "aarch64_sve_s" # i # zm # "_" # mul, [IsStreaming], []>;
1992+
def SVU # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "UcUsUiUl", MergeNone, "aarch64_sve_u" # i # zm # "_" # mul, [IsStreaming], []>;
1993+
def SVF # NAME : SInst<"sv" # i # "[" # zm # "_{d}_" # mul # "]", t, "hfd", MergeNone, "aarch64_sve_f" # i # zm # "_" # mul, [IsStreaming], []>;
1994+
}
1995+
1996+
let TargetGuard = "sme2" in {
1997+
// == SMAX / UMAX / FMAX ==
1998+
defm MAX_SINGLE_X2 : MinMaxIntr<"max", "_single", "x2", "22d">;
1999+
defm MAX_MULTI_X2 : MinMaxIntr<"max", "", "x2", "222">;
2000+
defm MAX_SINGLE_X4 : MinMaxIntr<"max", "_single", "x4", "44d">;
2001+
defm MAX_MULTI_X4 : MinMaxIntr<"max", "", "x4", "444">;
2002+
2003+
// == SMIN / UMIN / FMIN ==
2004+
defm MIN_SINGLE_X2 : MinMaxIntr<"min", "_single", "x2", "22d">;
2005+
defm MIN_MULTI_X2 : MinMaxIntr<"min", "", "x2", "222">;
2006+
defm MIN_SINGLE_X4 : MinMaxIntr<"min", "_single", "x4", "44d">;
2007+
defm MIN_MULTI_X4 : MinMaxIntr<"min", "", "x4", "444">;
2008+
}
2009+
19902010
let TargetGuard = "sme2" in {
19912011
// == ADD (vectors) ==
19922012
def SVADD_SINGLE_X2 : SInst<"svadd[_single_{d}_x2]", "22d", "cUcsUsiUilUl", MergeNone, "aarch64_sve_add_single_x2", [IsStreaming], []>;

0 commit comments

Comments
 (0)