[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-06-07 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf added inline comments.



Comment at: clang/test/CodeGen/ppc-xmmintrin.c:10
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns

bjope wrote:
> qiucf wrote:
> > bjope wrote:
> > > Unfortunately I get some failures with this. Maybe because of an 
> > > unstandard build setup.
> > > 
> > > We've started to use `-DCLANG_DEFAULT_RTLIB=compiler-rt 
> > > -DCLANG_DEFAULT_CXX_STDLIB=libc++` when building clang. And we also use 
> > > `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`. Not sure if that is a setup 
> > > that is asking for trouble. Anyway, when running this test case we end up 
> > > with
> > > 
> > > ```
> > > : 'RUN: at line 10';   /workspace/llvm/build/bin/clang -x c++ 
> > > -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 
> > > -ffreestanding -DNO_WARN_X86_INTRINSICS 
> > > /workspace/clang/test/CodeGen/ppc-xmmintrin.c-fno-discard-value-names 
> > > -mllvm -disable-llvm-optzns
> > > --
> > > Exit Code: 1
> > > 
> > > Command Output (stderr):
> > > --
> > > In file included from /workspace/clang/test/CodeGen/ppc-xmmintrin.c:13:
> > > In file included from 
> > > /workspace/llvm/build/lib/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:42:
> > > In file included from 
> > > /workspace/llvm/build/lib/clang/13.0.0/include/altivec.h:44:
> > > In file included from 
> > > /workspace/llvm/build/bin/../include/c++/v1/stddef.h:39:
> > > /workspace/llvm/build/bin/../include/c++/v1/__config:13:10: fatal error: 
> > > '__config_site' file not found
> > > #include <__config_site>
> > >  ^~~
> > > 1 error generated.
> > > ```
> > > 
> > > Not sure really how to solve that.
> > > 
> > > Maybe we should stop building like that?
> > > 
> > > Or there is a bug somewhere (such as that we only get the __config_site 
> > > headers in target specific dirs for targets that we actually build 
> > > runtimes for, maybe something that was missing in 
> > > https://reviews.llvm.org/D97572)?
> > > (Maybe @phosek  could comment on that?)
> > > 
> > > Or this test case is missing some options to make it a bit more 
> > > independent on the runtimes build setup?
> > > 
> > The tests relies on some system stuff. Is the failure related to this 
> > change? (or exposed by `-x c++` option?)
> Well, i guess it was exposed by `-x c++` (in combination with D975729).
> 
> I don't really understand how things are supposed to work given the 
> pre-target specific `__config_site`.
> 
> Since I only build libcxx for `x86_64-unknown-linux-gnu`, I only get a 
> `__config_site` file for that specific triple inside 
> `bin/../include/x86_64-unknown-linux-gnu/c++/v1/__config_site` in the build 
> result. But a test case like this one, using a different triple, ends up 
> including `bin/../include/c++/v1/stddef.h`, that wants wants to include 
> `<__config_site>`, but it won't find any such include for the 
> powerpc64le-unknown-linux-gnu triple.
Hi, I tried a build with `libcxx` enabled on ppc64le, by default it still looks 
for `stddef.h` inside `lib/clang/13.0.0/include`. If I specify `-isystem 
include/c++/v1`, the error won't happen because `__config_site` is there.

I didn't try `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` since that makes build 
complaining `bin/clang-tblgen: error while loading shared libraries: 
libc++.so.1: cannot open shared object file`.

The revision is going to LLVM 12.0.1. And this failure doesn't look like a 
blocker, since (if I understand correctly) even without this patch, a simple 
test also triggers that in the condition you provided.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-06-03 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added inline comments.



Comment at: clang/test/CodeGen/ppc-xmmintrin.c:10
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns

qiucf wrote:
> bjope wrote:
> > Unfortunately I get some failures with this. Maybe because of an unstandard 
> > build setup.
> > 
> > We've started to use `-DCLANG_DEFAULT_RTLIB=compiler-rt 
> > -DCLANG_DEFAULT_CXX_STDLIB=libc++` when building clang. And we also use 
> > `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`. Not sure if that is a setup that 
> > is asking for trouble. Anyway, when running this test case we end up with
> > 
> > ```
> > : 'RUN: at line 10';   /workspace/llvm/build/bin/clang -x c++ -fsyntax-only 
> > -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding 
> > -DNO_WARN_X86_INTRINSICS /workspace/clang/test/CodeGen/ppc-xmmintrin.c
> > -fno-discard-value-names -mllvm -disable-llvm-optzns
> > --
> > Exit Code: 1
> > 
> > Command Output (stderr):
> > --
> > In file included from /workspace/clang/test/CodeGen/ppc-xmmintrin.c:13:
> > In file included from 
> > /workspace/llvm/build/lib/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:42:
> > In file included from 
> > /workspace/llvm/build/lib/clang/13.0.0/include/altivec.h:44:
> > In file included from 
> > /workspace/llvm/build/bin/../include/c++/v1/stddef.h:39:
> > /workspace/llvm/build/bin/../include/c++/v1/__config:13:10: fatal error: 
> > '__config_site' file not found
> > #include <__config_site>
> >  ^~~
> > 1 error generated.
> > ```
> > 
> > Not sure really how to solve that.
> > 
> > Maybe we should stop building like that?
> > 
> > Or there is a bug somewhere (such as that we only get the __config_site 
> > headers in target specific dirs for targets that we actually build runtimes 
> > for, maybe something that was missing in https://reviews.llvm.org/D97572)?
> > (Maybe @phosek  could comment on that?)
> > 
> > Or this test case is missing some options to make it a bit more independent 
> > on the runtimes build setup?
> > 
> The tests relies on some system stuff. Is the failure related to this change? 
> (or exposed by `-x c++` option?)
Well, i guess it was exposed by `-x c++` (in combination with D975729).

I don't really understand how things are supposed to work given the pre-target 
specific `__config_site`.

Since I only build libcxx for `x86_64-unknown-linux-gnu`, I only get a 
`__config_site` file for that specific triple inside 
`bin/../include/x86_64-unknown-linux-gnu/c++/v1/__config_site` in the build 
result. But a test case like this one, using a different triple, ends up 
including `bin/../include/c++/v1/stddef.h`, that wants wants to include 
`<__config_site>`, but it won't find any such include for the 
powerpc64le-unknown-linux-gnu triple.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-06-02 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf added inline comments.



Comment at: clang/test/CodeGen/ppc-xmmintrin.c:10
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns

bjope wrote:
> Unfortunately I get some failures with this. Maybe because of an unstandard 
> build setup.
> 
> We've started to use `-DCLANG_DEFAULT_RTLIB=compiler-rt 
> -DCLANG_DEFAULT_CXX_STDLIB=libc++` when building clang. And we also use 
> `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`. Not sure if that is a setup that 
> is asking for trouble. Anyway, when running this test case we end up with
> 
> ```
> : 'RUN: at line 10';   /workspace/llvm/build/bin/clang -x c++ -fsyntax-only 
> -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding 
> -DNO_WARN_X86_INTRINSICS /workspace/clang/test/CodeGen/ppc-xmmintrin.c
> -fno-discard-value-names -mllvm -disable-llvm-optzns
> --
> Exit Code: 1
> 
> Command Output (stderr):
> --
> In file included from /workspace/clang/test/CodeGen/ppc-xmmintrin.c:13:
> In file included from 
> /workspace/llvm/build/lib/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:42:
> In file included from 
> /workspace/llvm/build/lib/clang/13.0.0/include/altivec.h:44:
> In file included from /workspace/llvm/build/bin/../include/c++/v1/stddef.h:39:
> /workspace/llvm/build/bin/../include/c++/v1/__config:13:10: fatal error: 
> '__config_site' file not found
> #include <__config_site>
>  ^~~
> 1 error generated.
> ```
> 
> Not sure really how to solve that.
> 
> Maybe we should stop building like that?
> 
> Or there is a bug somewhere (such as that we only get the __config_site 
> headers in target specific dirs for targets that we actually build runtimes 
> for, maybe something that was missing in https://reviews.llvm.org/D97572)?
> (Maybe @phosek  could comment on that?)
> 
> Or this test case is missing some options to make it a bit more independent 
> on the runtimes build setup?
> 
The tests relies on some system stuff. Is the failure related to this change? 
(or exposed by `-x c++` option?)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-06-01 Thread Bjorn Pettersson via Phabricator via cfe-commits
bjope added subscribers: phosek, bjope.
bjope added inline comments.



Comment at: clang/test/CodeGen/ppc-xmmintrin.c:10
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns

Unfortunately I get some failures with this. Maybe because of an unstandard 
build setup.

We've started to use `-DCLANG_DEFAULT_RTLIB=compiler-rt 
-DCLANG_DEFAULT_CXX_STDLIB=libc++` when building clang. And we also use 
`-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`. Not sure if that is a setup that is 
asking for trouble. Anyway, when running this test case we end up with

```
: 'RUN: at line 10';   /workspace/llvm/build/bin/clang -x c++ -fsyntax-only 
-target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding 
-DNO_WARN_X86_INTRINSICS /workspace/clang/test/CodeGen/ppc-xmmintrin.c
-fno-discard-value-names -mllvm -disable-llvm-optzns
--
Exit Code: 1

Command Output (stderr):
--
In file included from /workspace/clang/test/CodeGen/ppc-xmmintrin.c:13:
In file included from 
/workspace/llvm/build/lib/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:42:
In file included from 
/workspace/llvm/build/lib/clang/13.0.0/include/altivec.h:44:
In file included from /workspace/llvm/build/bin/../include/c++/v1/stddef.h:39:
/workspace/llvm/build/bin/../include/c++/v1/__config:13:10: fatal error: 
'__config_site' file not found
#include <__config_site>
 ^~~
1 error generated.
```

Not sure really how to solve that.

Maybe we should stop building like that?

Or there is a bug somewhere (such as that we only get the __config_site headers 
in target specific dirs for targets that we actually build runtimes for, maybe 
something that was missing in https://reviews.llvm.org/D97572)?
(Maybe @phosek  could comment on that?)

Or this test case is missing some options to make it a bit more independent on 
the runtimes build setup?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-05-31 Thread Qiu Chaofan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc0b3071833a8: [PowerPC] Fix x86 vector intrinsics wrapper 
compilation under C++ (authored by qiucf, committed by ecnelises).

Changed prior to commit:
  https://reviews.llvm.org/D103386?vs=348726=348835#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

Files:
  clang/lib/Headers/ppc_wrappers/xmmintrin.h
  clang/test/CodeGen/ppc-xmmintrin.c


Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -3,8 +3,12 @@
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 
-ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 
-ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 
 #include 
 
@@ -1426,7 +1430,7 @@
 
 void __attribute__((noinline))
 test_prefetch() {
-  _mm_prefetch(ms, i);
+  _mm_prefetch(ms, _MM_HINT_NTA);
 }
 
 // CHECK-LABEL: @test_prefetch
Index: clang/lib/Headers/ppc_wrappers/xmmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -28,7 +28,7 @@
Most SSE scalar float intrinsic operations can be performed more
efficiently as C language float scalar operations or optimized to
use vector SIMD operations. We recommend this for new applications. */
-#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable 
this error."
+#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable 
this error."
 #endif
 
 #ifndef _XMMINTRIN_H_INCLUDED
@@ -62,14 +62,13 @@
 
 /* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components.  */
-typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef vector float __m128 __attribute__((__may_alias__));
 
 /* Unaligned version of the same type.  */
-typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__,
-  __aligned__ (1)));
+typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1)));
 
 /* Internal data types for implementing the intrinsics.  */
-typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+typedef vector float __v4sf;
 
 /* Create an undefined vector.  */
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))


Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -3,8 +3,12 @@
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 
 #include 
 
@@ -1426,7 +1430,7 @@
 
 void __attribute__((noinline))
 test_prefetch() {
-  _mm_prefetch(ms, i);
+  _mm_prefetch(ms, _MM_HINT_NTA);
 }
 
 // CHECK-LABEL: @test_prefetch
Index: clang/lib/Headers/ppc_wrappers/xmmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -28,7 +28,7 @@
Most SSE scalar float intrinsic operations can be performed more

[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-05-31 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks for fixing this.




Comment at: clang/lib/Headers/ppc_wrappers/xmmintrin.h:31
use vector SIMD operations. We recommend this for new applications. */
 #error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable 
this error."
 #endif

I agree that it would be good to get rid of the extra space. :)



Comment at: clang/test/CodeGen/ppc-xmmintrin.c:1433
 test_prefetch() {
-  _mm_prefetch(ms, i);
+  _mm_prefetch(ms, (enum _mm_hint)i);
 }

I am not sure if this file has any tests that use the actual enumerators rather 
than an integer, but it seems like we should.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103386/new/

https://reviews.llvm.org/D103386

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

2021-05-30 Thread Qiu Chaofan via Phabricator via cfe-commits
qiucf created this revision.
qiucf added reviewers: PowerPC, jsji, nemanjai.
Herald added subscribers: shchenz, kbarton.
qiucf requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103386

Files:
  clang/lib/Headers/ppc_wrappers/xmmintrin.h
  clang/test/CodeGen/ppc-xmmintrin.c


Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -3,8 +3,12 @@
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 
-ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 
-ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | 
llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu 
-mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 
 #include 
 
@@ -1426,7 +1430,7 @@
 
 void __attribute__((noinline))
 test_prefetch() {
-  _mm_prefetch(ms, i);
+  _mm_prefetch(ms, (enum _mm_hint)i);
 }
 
 // CHECK-LABEL: @test_prefetch
Index: clang/lib/Headers/ppc_wrappers/xmmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -62,14 +62,13 @@
 
 /* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components.  */
-typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef vector float __m128 __attribute__((__may_alias__));
 
 /* Unaligned version of the same type.  */
-typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__,
-  __aligned__ (1)));
+typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1)));
 
 /* Internal data types for implementing the intrinsics.  */
-typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+typedef vector float __v4sf;
 
 /* Create an undefined vector.  */
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, 
__artificial__))


Index: clang/test/CodeGen/ppc-xmmintrin.c
===
--- clang/test/CodeGen/ppc-xmmintrin.c
+++ clang/test/CodeGen/ppc-xmmintrin.c
@@ -3,8 +3,12 @@
 
 // RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 // RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
 
 #include 
 
@@ -1426,7 +1430,7 @@
 
 void __attribute__((noinline))
 test_prefetch() {
-  _mm_prefetch(ms, i);
+  _mm_prefetch(ms, (enum _mm_hint)i);
 }
 
 // CHECK-LABEL: @test_prefetch
Index: clang/lib/Headers/ppc_wrappers/xmmintrin.h
===
--- clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -62,14 +62,13 @@
 
 /* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components.  */
-typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+typedef vector float __m128 __attribute__((__may_alias__));
 
 /* Unaligned version of the same type.  */
-typedef float __m128_u __attribute__ ((__vector_size__ (16), __may_alias__,
-   __aligned__ (1)));
+typedef vector float __m128_u __attribute__((__may_alias__, __aligned__(1)));
 
 /* Internal data types for implementing the intrinsics.  */
-typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+typedef vector float __v4sf;
 
 /* Create an undefined vector.  */
 extern __inline __m128