[clang] [PowerPC] Update altivec.h to use __inline__ for c89 compatibility (PR #134430)
Lei Huang via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 4 11:55:51 PDT 2025
https://github.com/lei137 updated https://github.com/llvm/llvm-project/pull/134430
>From 951dc421024f0a5fe7148734eb6efe8d457bc4f6 Mon Sep 17 00:00:00 2001
From: Lei Huang <lei at ca.ibm.com>
Date: Fri, 4 Apr 2025 14:31:54 -0400
Subject: [PATCH 1/3] [PowerPC] Update altivec.h to use __inline__ for c89
compatibility
---
clang/lib/Headers/altivec.h | 92 ++++++++++++++---------------
clang/test/Headers/altivec-header.c | 1 +
2 files changed, 47 insertions(+), 46 deletions(-)
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 8da65055012f1..4b1b13aadf135 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -17525,70 +17525,70 @@ vec_bperm(vector unsigned long long __a, vector unsigned char __b) {
/* vec_reve */
-static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
+static __inline__ __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
+static __inline__ __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector unsigned char
+static __inline__ __ATTRS_o_ai vector unsigned char
vec_reve(vector unsigned char __a) {
return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
+static __inline__ __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
+static __inline__ __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector unsigned int
+static __inline__ __ATTRS_o_ai vector unsigned int
vec_reve(vector unsigned int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
+static __inline__ __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector signed short
+static __inline__ __ATTRS_o_ai vector signed short
vec_reve(vector signed short __a) {
return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector unsigned short
+static __inline__ __ATTRS_o_ai vector unsigned short
vec_reve(vector unsigned short __a) {
return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
}
-static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
+static __inline__ __ATTRS_o_ai vector float vec_reve(vector float __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
#ifdef __VSX__
-static inline __ATTRS_o_ai vector bool long long
+static __inline__ __ATTRS_o_ai vector bool long long
vec_reve(vector bool long long __a) {
return __builtin_shufflevector(__a, __a, 1, 0);
}
-static inline __ATTRS_o_ai vector signed long long
+static __inline__ __ATTRS_o_ai vector signed long long
vec_reve(vector signed long long __a) {
return __builtin_shufflevector(__a, __a, 1, 0);
}
-static inline __ATTRS_o_ai vector unsigned long long
+static __inline__ __ATTRS_o_ai vector unsigned long long
vec_reve(vector unsigned long long __a) {
return __builtin_shufflevector(__a, __a, 1, 0);
}
-static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
+static __inline__ __ATTRS_o_ai vector double vec_reve(vector double __a) {
return __builtin_shufflevector(__a, __a, 1, 0);
}
#endif
@@ -17721,41 +17721,41 @@ typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
typedef vector float unaligned_vec_float __attribute__((aligned(1)));
-static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
const signed char *__ptr) {
return *(unaligned_vec_schar *)(__ptr + __offset);
}
-static inline __ATTRS_o_ai vector unsigned char
+static __inline__ __ATTRS_o_ai vector unsigned char
vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
return *(unaligned_vec_uchar*)(__ptr + __offset);
}
-static inline __ATTRS_o_ai vector signed short
+static __inline__ __ATTRS_o_ai vector signed short
vec_xl(ptrdiff_t __offset, const signed short *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_sshort *)__addr;
}
-static inline __ATTRS_o_ai vector unsigned short
+static __inline__ __ATTRS_o_ai vector unsigned short
vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_ushort *)__addr;
}
-static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
const signed int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_sint *)__addr;
}
-static inline __ATTRS_o_ai vector unsigned int
+static __inline__ __ATTRS_o_ai vector unsigned int
vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_uint *)__addr;
}
-static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
const float *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_float *)__addr;
@@ -17766,19 +17766,19 @@ typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
typedef vector double unaligned_vec_double __attribute__((aligned(1)));
-static inline __ATTRS_o_ai vector signed long long
+static __inline__ __ATTRS_o_ai vector signed long long
vec_xl(ptrdiff_t __offset, const signed long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_sll *)__addr;
}
-static inline __ATTRS_o_ai vector unsigned long long
+static __inline__ __ATTRS_o_ai vector unsigned long long
vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_ull *)__addr;
}
-static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
const double *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_double *)__addr;
@@ -17790,13 +17790,13 @@ static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
typedef vector unsigned __int128 unaligned_vec_ui128
__attribute__((aligned(1)));
-static inline __ATTRS_o_ai vector signed __int128
+static __inline__ __ATTRS_o_ai vector signed __int128
vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_si128 *)__addr;
}
-static inline __ATTRS_o_ai vector unsigned __int128
+static __inline__ __ATTRS_o_ai vector unsigned __int128
vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_ui128 *)__addr;
@@ -17991,63 +17991,63 @@ vec_load_splats(unsigned long long __offset, const float *__ptr) {
#define vec_xstd2 vec_xst
#define vec_xstw4 vec_xst
-static inline __ATTRS_o_ai void
+static __inline__ __ATTRS_o_ai void
vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) {
*(unaligned_vec_schar *)(__ptr + __offset) = __vec;
}
-static inline __ATTRS_o_ai void
+static __inline__ __ATTRS_o_ai void
vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) {
*(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
}
-static inline __ATTRS_o_ai void
+static __inline__ __ATTRS_o_ai void
vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_sshort *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
ptrdiff_t __offset,
unsigned short *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_ushort *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector signed int __vec,
ptrdiff_t __offset, signed int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_sint *)__addr = __vec;
}
-static inline __ATTRS_o_ai void
+static __inline__ __ATTRS_o_ai void
vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_uint *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
float *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_float *)__addr = __vec;
}
#ifdef __VSX__
-static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector signed long long __vec,
ptrdiff_t __offset,
signed long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_sll *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
ptrdiff_t __offset,
unsigned long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_ull *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
+static __inline__ __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
double *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_double *)__addr = __vec;
@@ -18056,14 +18056,14 @@ static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
defined(__SIZEOF_INT128__)
-static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
ptrdiff_t __offset,
signed __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_si128 *)__addr = __vec;
}
-static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
ptrdiff_t __offset,
unsigned __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
@@ -18075,49 +18075,49 @@ static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
defined(__SIZEOF_INT128__)
-static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
ptrdiff_t __offset,
signed char *__ptr) {
*(__ptr + __offset) = (signed char)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
ptrdiff_t __offset,
unsigned char *__ptr) {
*(__ptr + __offset) = (unsigned char)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
ptrdiff_t __offset,
signed short *__ptr) {
*(__ptr + __offset) = (signed short)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
ptrdiff_t __offset,
unsigned short *__ptr) {
*(__ptr + __offset) = (unsigned short)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
ptrdiff_t __offset,
signed int *__ptr) {
*(__ptr + __offset) = (signed int)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
ptrdiff_t __offset,
unsigned int *__ptr) {
*(__ptr + __offset) = (unsigned int)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
ptrdiff_t __offset,
signed long long *__ptr) {
*(__ptr + __offset) = (signed long long)__vec[0];
}
-static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
+static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
ptrdiff_t __offset,
unsigned long long *__ptr) {
*(__ptr + __offset) = (unsigned long long)__vec[0];
diff --git a/clang/test/Headers/altivec-header.c b/clang/test/Headers/altivec-header.c
index 00e5f444de7cc..2b57c640d9542 100644
--- a/clang/test/Headers/altivec-header.c
+++ b/clang/test/Headers/altivec-header.c
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -flax-vector-conversions=none -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c89 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
#include <altivec.h>
>From 86d8a247f5249c89bb05cd02fd370c1517ad8731 Mon Sep 17 00:00:00 2001
From: Lei Huang <lei at ca.ibm.com>
Date: Fri, 4 Apr 2025 14:40:49 -0400
Subject: [PATCH 2/3] apply clang-format
---
clang/lib/Headers/altivec.h | 93 +++++++++++++++++++------------------
1 file changed, 48 insertions(+), 45 deletions(-)
diff --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 4b1b13aadf135..71d8d3c0c0771 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -17530,7 +17530,8 @@ static __inline__ __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
5, 4, 3, 2, 1, 0);
}
-static __inline__ __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
+static __inline__ __ATTRS_o_ai vector signed char
+vec_reve(vector signed char __a) {
return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
5, 4, 3, 2, 1, 0);
}
@@ -17545,7 +17546,8 @@ static __inline__ __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
-static __inline__ __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
+static __inline__ __ATTRS_o_ai vector signed int
+vec_reve(vector signed int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
@@ -17554,7 +17556,8 @@ vec_reve(vector unsigned int __a) {
return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
}
-static __inline__ __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
+static __inline__ __ATTRS_o_ai vector bool short
+vec_reve(vector bool short __a) {
return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
}
@@ -17721,8 +17724,8 @@ typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
typedef vector float unaligned_vec_float __attribute__((aligned(1)));
-static __inline__ __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
- const signed char *__ptr) {
+static __inline__ __ATTRS_o_ai vector signed char
+vec_xl(ptrdiff_t __offset, const signed char *__ptr) {
return *(unaligned_vec_schar *)(__ptr + __offset);
}
@@ -17743,8 +17746,8 @@ vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
return *(unaligned_vec_ushort *)__addr;
}
-static __inline__ __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
- const signed int *__ptr) {
+static __inline__ __ATTRS_o_ai vector signed int
+vec_xl(ptrdiff_t __offset, const signed int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_sint *)__addr;
}
@@ -17756,7 +17759,7 @@ vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
}
static __inline__ __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
- const float *__ptr) {
+ const float *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_float *)__addr;
}
@@ -17779,7 +17782,7 @@ vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
}
static __inline__ __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
- const double *__ptr) {
+ const double *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
return *(unaligned_vec_double *)__addr;
}
@@ -18008,14 +18011,14 @@ vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
}
static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
- ptrdiff_t __offset,
- unsigned short *__ptr) {
+ ptrdiff_t __offset,
+ unsigned short *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_ushort *)__addr = __vec;
}
-static __inline__ __ATTRS_o_ai void vec_xst(vector signed int __vec,
- ptrdiff_t __offset, signed int *__ptr) {
+static __inline__ __ATTRS_o_ai void
+vec_xst(vector signed int __vec, ptrdiff_t __offset, signed int *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_sint *)__addr = __vec;
}
@@ -18026,29 +18029,29 @@ vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
*(unaligned_vec_uint *)__addr = __vec;
}
-static __inline__ __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
- float *__ptr) {
+static __inline__ __ATTRS_o_ai void vec_xst(vector float __vec,
+ ptrdiff_t __offset, float *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_float *)__addr = __vec;
}
#ifdef __VSX__
static __inline__ __ATTRS_o_ai void vec_xst(vector signed long long __vec,
- ptrdiff_t __offset,
- signed long long *__ptr) {
+ ptrdiff_t __offset,
+ signed long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_sll *)__addr = __vec;
}
static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
- ptrdiff_t __offset,
- unsigned long long *__ptr) {
+ ptrdiff_t __offset,
+ unsigned long long *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_ull *)__addr = __vec;
}
-static __inline__ __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
- double *__ptr) {
+static __inline__ __ATTRS_o_ai void vec_xst(vector double __vec,
+ ptrdiff_t __offset, double *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_double *)__addr = __vec;
}
@@ -18057,15 +18060,15 @@ static __inline__ __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __off
#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
defined(__SIZEOF_INT128__)
static __inline__ __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
- ptrdiff_t __offset,
- signed __int128 *__ptr) {
+ ptrdiff_t __offset,
+ signed __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_si128 *)__addr = __vec;
}
static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
- ptrdiff_t __offset,
- unsigned __int128 *__ptr) {
+ ptrdiff_t __offset,
+ unsigned __int128 *__ptr) {
signed char *__addr = (signed char *)__ptr + __offset;
*(unaligned_vec_ui128 *)__addr = __vec;
}
@@ -18076,50 +18079,50 @@ static __inline__ __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
defined(__SIZEOF_INT128__)
static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
- ptrdiff_t __offset,
- signed char *__ptr) {
+ ptrdiff_t __offset,
+ signed char *__ptr) {
*(__ptr + __offset) = (signed char)__vec[0];
}
-static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
- ptrdiff_t __offset,
- unsigned char *__ptr) {
+static __inline__ __ATTRS_o_ai void
+vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
+ unsigned char *__ptr) {
*(__ptr + __offset) = (unsigned char)__vec[0];
}
static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
- ptrdiff_t __offset,
- signed short *__ptr) {
+ ptrdiff_t __offset,
+ signed short *__ptr) {
*(__ptr + __offset) = (signed short)__vec[0];
}
-static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
- ptrdiff_t __offset,
- unsigned short *__ptr) {
+static __inline__ __ATTRS_o_ai void
+vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
+ unsigned short *__ptr) {
*(__ptr + __offset) = (unsigned short)__vec[0];
}
static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
- ptrdiff_t __offset,
- signed int *__ptr) {
+ ptrdiff_t __offset,
+ signed int *__ptr) {
*(__ptr + __offset) = (signed int)__vec[0];
}
-static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
- ptrdiff_t __offset,
- unsigned int *__ptr) {
+static __inline__ __ATTRS_o_ai void
+vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
+ unsigned int *__ptr) {
*(__ptr + __offset) = (unsigned int)__vec[0];
}
static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
- ptrdiff_t __offset,
- signed long long *__ptr) {
+ ptrdiff_t __offset,
+ signed long long *__ptr) {
*(__ptr + __offset) = (signed long long)__vec[0];
}
-static __inline__ __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
- ptrdiff_t __offset,
- unsigned long long *__ptr) {
+static __inline__ __ATTRS_o_ai void
+vec_xst_trunc(vector unsigned __int128 __vec, ptrdiff_t __offset,
+ unsigned long long *__ptr) {
*(__ptr + __offset) = (unsigned long long)__vec[0];
}
#endif
>From 50775d09401417ae0f51d98816088d8619666a14 Mon Sep 17 00:00:00 2001
From: Lei Huang <lei at ca.ibm.com>
Date: Fri, 4 Apr 2025 14:55:29 -0400
Subject: [PATCH 3/3] apply suggestion from review
---
clang/test/Headers/altivec-header.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/test/Headers/altivec-header.c b/clang/test/Headers/altivec-header.c
index 2b57c640d9542..67aee4b270ca6 100644
--- a/clang/test/Headers/altivec-header.c
+++ b/clang/test/Headers/altivec-header.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -flax-vector-conversions=none -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s
// RUN: %clang_cc1 -std=c89 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-feature +altivec -ffreestanding -emit-llvm -x c++ -o - %s | FileCheck %s
#include <altivec.h>
More information about the cfe-commits
mailing list