Skip to content

Commit 0826268

Browse files
ecneliseststellar
authored andcommitted
[PowerPC] Fix x86 vector intrinsics wrapper compilation under C++
Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D103386 (cherry picked from commit c0b3071)
1 parent 6a86669 commit 0826268

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

clang/lib/Headers/ppc_wrappers/xmmintrin.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Most SSE scalar float intrinsic operations can be performed more
2929
efficiently as C language float scalar operations or optimized to
3030
use vector SIMD operations. We recommend this for new applications. */
31-
#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
31+
#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
3232
#endif
3333

3434
#ifndef _XMMINTRIN_H_INCLUDED
@@ -62,14 +62,13 @@
6262

6363
/* The Intel API is flexible enough that we must allow aliasing with other
6464
vector types, and their scalar components. */
65-
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
65+
typedef vector float __m128 __attribute__((__may_alias__));
6666

6767
/* Unaligned version of the same type. */
68-
typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__,
69-
__aligned__ (1)));
68+
typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1)));
7069

7170
/* Internal data types for implementing the intrinsics. */
72-
typedef float __v4sf __attribute__ ((__vector_size__ (16)));
71+
typedef vector float __v4sf;
7372

7473
/* Create an undefined vector. */
7574
extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))

clang/test/CodeGen/ppc-xmmintrin.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33

44
// RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
55
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
6+
// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
7+
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns
68
// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
79
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
10+
// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
11+
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns
812

913
#include <xmmintrin.h>
1014

@@ -1426,7 +1430,7 @@ test_mul() {
14261430

14271431
void __attribute__((noinline))
14281432
test_prefetch() {
1429-
_mm_prefetch(ms, i);
1433+
_mm_prefetch(ms, _MM_HINT_NTA);
14301434
}
14311435

14321436
// CHECK-LABEL: @test_prefetch

0 commit comments

Comments
 (0)