[clang] [LoongArch][Clang] Make the parameters and return value of {x,}vorn.v builti ns `unsigned char` vectors (PR #114514)
Xi Ruoyao via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 03:30:58 PST 2024
https://github.com/xry111 updated https://github.com/llvm/llvm-project/pull/114514
>From bfd9e855bc1c91bee6c39e388f20be48db8dfd8f Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111 at xry111.site>
Date: Fri, 1 Nov 2024 00:28:12 +0800
Subject: [PATCH] [LoongArch][Clang] Make the parameters and return value of
{x,}vorn.v builtins `unsigned char` vectors
All other bitwise vector builtins use `unsigned char` vector operands,
so it does not make too much sense to use `signed char` for the orn
operation alone.
The same change has been also proposed for GCC:
https://gcc.gnu.org/pipermail/gcc-patches/2024-October/667065.html.
---
clang/include/clang/Basic/BuiltinsLoongArchLASX.def | 2 +-
clang/include/clang/Basic/BuiltinsLoongArchLSX.def | 2 +-
clang/lib/Headers/lasxintrin.h | 2 +-
clang/lib/Headers/lsxintrin.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/Basic/BuiltinsLoongArchLASX.def b/clang/include/clang/Basic/BuiltinsLoongArchLASX.def
index f644b820a61898..c4ea46a3bc5b51 100644
--- a/clang/include/clang/Basic/BuiltinsLoongArchLASX.def
+++ b/clang/include/clang/Basic/BuiltinsLoongArchLASX.def
@@ -371,7 +371,7 @@ TARGET_BUILTIN(__builtin_lasx_xvor_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvxor_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvnor_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvandn_v, "V32UcV32UcV32Uc", "nc", "lasx")
-TARGET_BUILTIN(__builtin_lasx_xvorn_v, "V32ScV32ScV32Sc", "nc", "lasx")
+TARGET_BUILTIN(__builtin_lasx_xvorn_v, "V32UcV32UcV32Uc", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvandi_b, "V32UcV32UcIUi", "nc", "lasx")
TARGET_BUILTIN(__builtin_lasx_xvori_b, "V32UcV32UcIUi", "nc", "lasx")
diff --git a/clang/include/clang/Basic/BuiltinsLoongArchLSX.def b/clang/include/clang/Basic/BuiltinsLoongArchLSX.def
index b3056971986d19..a823783af88c4f 100644
--- a/clang/include/clang/Basic/BuiltinsLoongArchLSX.def
+++ b/clang/include/clang/Basic/BuiltinsLoongArchLSX.def
@@ -355,7 +355,7 @@ TARGET_BUILTIN(__builtin_lsx_vor_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vxor_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vnor_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vandn_v, "V16UcV16UcV16Uc", "nc", "lsx")
-TARGET_BUILTIN(__builtin_lsx_vorn_v, "V16ScV16ScV16Sc", "nc", "lsx")
+TARGET_BUILTIN(__builtin_lsx_vorn_v, "V16UcV16UcV16Uc", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vandi_b, "V16UcV16UcIUi", "nc", "lsx")
TARGET_BUILTIN(__builtin_lsx_vori_b, "V16UcV16UcIUi", "nc", "lsx")
diff --git a/clang/lib/Headers/lasxintrin.h b/clang/lib/Headers/lasxintrin.h
index dafc2a2f3e6a70..c065ea92a2dd52 100644
--- a/clang/lib/Headers/lasxintrin.h
+++ b/clang/lib/Headers/lasxintrin.h
@@ -2585,7 +2585,7 @@ extern __inline
extern __inline
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m256i
__lasx_xvorn_v(__m256i _1, __m256i _2) {
- return (__m256i)__builtin_lasx_xvorn_v((v32i8)_1, (v32i8)_2);
+ return (__m256i)__builtin_lasx_xvorn_v((v32u8)_1, (v32u8)_2);
}
#define __lasx_xvldi(/*i13*/ _1) ((__m256i)__builtin_lasx_xvldi((_1)))
diff --git a/clang/lib/Headers/lsxintrin.h b/clang/lib/Headers/lsxintrin.h
index f347955ce6fb51..f020b0c18f0d29 100644
--- a/clang/lib/Headers/lsxintrin.h
+++ b/clang/lib/Headers/lsxintrin.h
@@ -3425,7 +3425,7 @@ extern __inline
extern __inline
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) __m128i
__lsx_vorn_v(__m128i _1, __m128i _2) {
- return (__m128i)__builtin_lsx_vorn_v((v16i8)_1, (v16i8)_2);
+ return (__m128i)__builtin_lsx_vorn_v((v16u8)_1, (v16u8)_2);
}
#define __lsx_vldi(/*i13*/ _1) ((__m128i)__builtin_lsx_vldi((_1)))
More information about the cfe-commits
mailing list