Re: Missing definition of a template virtual function

2016-06-05 Thread Richard Smith via cfe-commits
On Sun, Jun 5, 2016 at 10:27 PM, Srivastava, Sunil <
sunil.srivast...@sony.com> wrote:

> Hi Richard,
>
>
>
> Thanks for you analysis. I have some follow up questions though:
>
>
> First, either of these two suggestions below should fix the bug, though it
> may be better to do both. Right ?
>

Either should fix the immediate issue, but if we don't do (2) then the bug
will likely just be more subtle.


> Then, approach (2) has a cost. It will prevent devirtualizations of calls
> which could get defined elsewhere.
>

It will never prevent a correct devirtualization; it is never correct for
us to emit a direct reference to a function that we would emit as
linkonce_odr but that we can't emit. (We can do so if we know there's a
weak_odr definition somewhere else that we're allowed to reference, but in
that case we can and should emit the function locally as
available_externally instead.)

While my example of https://llvm.org/bugs/show_bug.cgi?id=27895#c4   is
> good for demonstrating the bug, it is an unusual case. The usual case is
> that the template will be defined somewhere. So by suppressing
> devirtualization in this case we will be penalizing the usual cases to fix
> a bug in unusual cases.
>
>
>
> The approach (1) is doable of course. It involves passing some kind of
> isFullObject flag few levels down in SemaOverload.cpp, and then prevent
> reset of OdrUse flag if isFullObject is true.
>
>
>
> However I want to understand better what is going on here. Specifically,
> why virtual operators are treated different from virtual functions.
>

I would expect the difference is operator syntax versus function call
syntax -- these go down quite different codepaths in Sema and it's quite
likely that they mark the function as used in subtly different ways. It
would make sense to unify the behavior here.


> In my example, if you replace the operator[] with a plain function doing
> the same thing, the function definition gets generated.
>
>
>
> In your bugzilla comment 5, you perhaps alluded to this point:
>
>
>
> > we model operator[] as weak_odr unnamed_addr, which would allow us to
>
> > discard the symbol in the other translation unit if we can merge the
>
> > function with something else, even though its address is exposed in
>
> > the vtable
>
>
>
> But what can the compiler do with user written operator[] that it can not
> do with a plain function ?
>
>
>
> Beside, this bug is not just with operator[]. It is with every member
> operator.
>
>
>
> Thanks
>
> Sunil Srivastava
>
> Sony Interactive Entertainment
>
>
>
> Yes, this is a bug. We emit a direct call to
> TmplWithArray::operator[] so we're required to also emit a
> definition of it. I think the code that r227073 removed was really masking
> this bug rather than fixing it. It seems like there are two issues here:
>
>
>
>  1) Sema should mark a virtual function as used if it sees an
> obviously-devirtualizable call to the function (where the base object has a
> known dynamic type)
>
>
>
>  2) Clang CodeGen's devirtualization of obviously-devirtualizable calls
> should not devirtualize calls to linkonce_odr functions that it can't emit
>
>
>
>
>
>
>
> --
>
> template < typename T, int N = 0 > class TmplWithArray {
>
> public:
>
>   virtual T& operator [] (int idx);
>
>   T ar[N+1];
>
> };
>
> template  T& TmplWithArray::operator[](int idx) {
>
>   return ar[idx];
>
> }
>
> class Wrapper {
>
>   TmplWithArray data;
>
>   bool indexIt(int a);
>
> };
>
> bool Wrapper::indexIt(int a)
>
> {
>
>return data[a];
>
> }
>
> int main(){}
>
> --
>
>
>
> Starting from  r227073 it does not link (at any optimization level). The
> code
>
> has a direct call to the operator[] function, but that function definition
> is
>
> not generated.
>
>
>
> Versions prior to r227073,
>
> -  at –O0 or –O1, generate the operator[] function and the direct
> call, and
>
> -  at –O2 do not generate the function, but inline it
>
> Either way they link fine.
>
>
>
> In this example the key-function for the generation of the vtable is the
>
> operator[] function itself.
>
>
>
> So the compiler can either generate both the vtable and the operator[]
>
> function, or not generate either; they are both consistent states.
>
>
>
> The call in data[a] is to a virtual function, and if the compiler left it
> as a
>
> virtual call, it will link. There will be no ctor, no vtable, and no
> operator[]
>
> function. Wrapper::indexIt will be dead code, but it will link.
>
>
>
> But the compiler does devirtualization of the call and generates a direct
> call,
>
> yet, beginning with r227073, it does not generate the operator[] function.
>
> Hence the link failure.
>
>
>
> Another interesting tidbit is that if the operator[] is replaced by a plain
>
> function doing the same thing, along with the corresponding change in the
>
> usage, something like:
>
> virtual T& getElt(int idx);
>
> then the behavior is

r271873 - [AVX512] Convert masked palignr builtins directly to native IR similar to the other palignr builtins, but with a select to handle masking.

2016-06-05 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Jun  6 01:13:01 2016
New Revision: 271873

URL: http://llvm.org/viewvc/llvm-project?rev=271873&view=rev
Log:
[AVX512] Convert masked palignr builtins directly to native IR similar to the 
other palignr builtins, but with a select to handle masking.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=271873&r1=271872&r2=271873&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jun  6 01:13:01 2016
@@ -6653,7 +6653,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return Builder.CreateDefaultAlignedStore(Ops[1], Ops[0]);
   }
   case X86::BI__builtin_ia32_palignr128:
-  case X86::BI__builtin_ia32_palignr256: {
+  case X86::BI__builtin_ia32_palignr256:
+  case X86::BI__builtin_ia32_palignr128_mask:
+  case X86::BI__builtin_ia32_palignr256_mask:
+  case X86::BI__builtin_ia32_palignr512_mask: {
 unsigned ShiftVal = cast(Ops[2])->getZExtValue();
 
 unsigned NumElts =
@@ -6673,7 +6676,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   Ops[0] = llvm::Constant::getNullValue(Ops[0]->getType());
 }
 
-int Indices[32];
+int Indices[64];
 // 256-bit palignr operates on 128-bit lanes so we need to handle that
 for (unsigned l = 0; l != NumElts; l += 16) {
   for (unsigned i = 0; i != 16; ++i) {
@@ -6684,10 +6687,25 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   }
 }
 
-return Builder.CreateShuffleVector(Ops[1], Ops[0],
-   makeArrayRef(Indices, NumElts),
-   "palignr");
+Value *Align = Builder.CreateShuffleVector(Ops[1], Ops[0],
+   makeArrayRef(Indices, NumElts),
+   "palignr");
+
+// If this isn't a masked builtin, just return the align operation.
+if (Ops.size() == 3)
+  return Align;
+
+// If the mask is all ones just emit the align operation.
+if (const auto *C = dyn_cast(Ops[4]))
+  if (C->isAllOnesValue())
+return Align;
+
+llvm::VectorType *MaskTy = llvm::VectorType::get(Builder.getInt1Ty(),
+ NumElts);
+llvm::Value *Mask = Builder.CreateBitCast(Ops[4], MaskTy, "cast");
+return Builder.CreateSelect(Mask, Align, Ops[3]);
   }
+
   case X86::BI__builtin_ia32_pslldqi256: {
 // Shift value is in bits so divide by 8.
 unsigned shiftVal = cast(Ops[1])->getZExtValue() >> 3;

Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=271873&r1=271872&r2=271873&view=diff
==
--- cfe/trunk/test/CodeGen/avx512bw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512bw-builtins.c Mon Jun  6 01:13:01 2016
@@ -1489,19 +1489,21 @@ __m512i test_mm512_mask_permutexvar_epi1
 }
 __m512i test_mm512_alignr_epi8(__m512i __A,__m512i __B){
 // CHECK-LABEL: @test_mm512_alignr_epi8
-// CHECK: @llvm.x86.avx512.mask.palignr.512
+// CHECK: shufflevector <64 x i8> %{{.*}}, <64 x i8> %{{.*}}, <64 x i32> 

 return _mm512_alignr_epi8(__A, __B, 2); 
 }
 
 __m512i test_mm512_mask_alignr_epi8(__m512i __W, __mmask64 __U, __m512i 
__A,__m512i __B){
 // CHECK-LABEL: @test_mm512_mask_alignr_epi8
-// CHECK: @llvm.x86.avx512.mask.palignr.512
+// CHECK: shufflevector <64 x i8> %{{.*}}, <64 x i8> %{{.*}}, <64 x i32> 

+// CHECK: select <64 x i1> %{{.*}}, <64 x i8> %{{.*}}, <64 x i8> %{{.*}}
 return _mm512_mask_alignr_epi8(__W, __U, __A, __B, 2); 
 }
 
 __m512i test_mm512_maskz_alignr_epi8(__mmask64 __U, __m512i __A,__m512i __B){
 // CHECK-LABEL: @test_mm512_maskz_alignr_epi8
-// CHECK: @llvm.x86.avx512.mask.palignr.512
+// CHECK: shufflevector <64 x i8> %{{.*}}, <64 x i8> %{{.*}}, <64 x i32> 

+// CHECK: select <64 x i1> %{{.*}}, <64 x i8> %{{.*}}, <64 x i8> %{{.*}}
return _mm512_maskz_alignr_epi8(__U, __A, __B, 2); 
 }
 

Modified: cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vlbw-builtins.c?rev=271873&r1=271872&r2=271873&view=diff
==
--- cfe/trunk/test/CodeGen/avx512vlbw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vlbw-builtins.c Mon Jun  6 01:13:01 2016
@@ -2318,25 +2318,29 @@ __m256i test_mm256_mask_permutexvar_epi1
 }
 __m128i test_mm_mask_alignr_epi8(__m128i __W, __mmask16 __U, __m128i __A, 
__m128i __B) {
   // CHECK-LABEL: @test_mm_mask_alignr_epi8
-  // CHECK: @llvm.x86.avx512.mask.palignr.128
+

r271866 - Slightly improve Visual Studio visualization of clang::Expr

2016-06-05 Thread Mike Spertus via cfe-commits
Author: mps
Date: Sun Jun  5 22:37:18 2016
New Revision: 271866

URL: http://llvm.org/viewvc/llvm-project?rev=271866&view=rev
Log:
Slightly improve Visual Studio visualization of clang::Expr

Now it gives the StmtClass of the Expr as well as the type. It's still
a long way from full visualization of expressions, but I have found
that having the class really helps when debugging, so definitely
worth submitting.

Modified:
cfe/trunk/utils/ClangVisualizers/clang.natvis

Modified: cfe/trunk/utils/ClangVisualizers/clang.natvis
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ClangVisualizers/clang.natvis?rev=271866&r1=271865&r2=271866&view=diff
==
--- cfe/trunk/utils/ClangVisualizers/clang.natvis (original)
+++ cfe/trunk/utils/ClangVisualizers/clang.natvis Sun Jun  5 22:37:18 2016
@@ -424,6 +424,6 @@ For later versions of Visual Studio, no
 
   
   
-Expression of type {TR,view(cpp)}
+Expression of class 
{(clang::Stmt::StmtClass)StmtBits.sClass,en} and type 
{TR,view(cpp)}
   
 


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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Mehdi Amini via cfe-commits
But what pipeline do we setup? For instance with ThinLTO we reduced the amount 
of passes ran during the compile phase with the expectation that more will run 
during the link, this would get fuzzy here...

> On Jun 5, 2016, at 6:49 PM, Davide Italiano  wrote:
> 
> davide added a comment.
> 
> In http://reviews.llvm.org/D21006#449409, @dexonsmith wrote:
> 
>> I agree with Mehdi.  I expect `-S -flto` to give equivalent output to `-c 
>> -flto`.
>> 
>> In effect, with this change, `-flto -S` would silently ignore the `-flto` 
>> flag.  That doesn't make sense to me.
> 
> 
> I guess there's enough disagreement to hold on on this change.
> My $0.02: When I ask for -S I really expect asm to be produced, but maybe 
> it's just me =)
> Lots of build systems have invocations of clang like:
> 
>  CFLAGS= -S
>  ${CC} ${CFLAGS} blah.c -o blah.s
>  sed -e ...
> 
> When CFLAGS is changed, as in:
> 
>  CFLAGS += -flto
> 
> this is generally passed globally. So, not emitting ASM in this case makes 
> LTO non transparent for the build system, i.e. Makefiles need to pass 
> `-fno-lto`, which might not be terrible overall, just not what I expect.
> 
> 
> http://reviews.llvm.org/D21006
> 
> 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

But what pipeline do we setup? For instance with ThinLTO we reduced the amount 
of passes ran during the compile phase with the expectation that more will run 
during the link, this would get fuzzy here...


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449409, @dexonsmith wrote:

> I agree with Mehdi.  I expect `-S -flto` to give equivalent output to `-c 
> -flto`.
>
> In effect, with this change, `-flto -S` would silently ignore the `-flto` 
> flag.  That doesn't make sense to me.


I guess there's enough disagreement to hold on on this change.
My $0.02: When I ask for -S I really expect asm to be produced, but maybe it's 
just me =)
Lots of build systems have invocations of clang like:

  CFLAGS= -S
  ${CC} ${CFLAGS} blah.c -o blah.s
  sed -e ...

When CFLAGS is changed, as in:

  CFLAGS += -flto

this is generally passed globally. So, not emitting ASM in this case makes LTO 
non transparent for the build system, i.e. Makefiles need to pass `-fno-lto`, 
which might not be terrible overall, just not what I expect.


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Ávila de Espíndola via cfe-commits
rafael added a comment.

Fair enough, let's keep it as is and try to update the build.

Cheers,
Rafael


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Espíndola via cfe-commits
Fair enough, let's keep it as is and try to update the build.

Cheers,
Rafael
On Jun 5, 2016 9:28 PM, "Mehdi AMINI"  wrote:

> mehdi_amini added a comment.
>
> What makes me not comfortable with this change is that after that  `-c`
> would not involves codegen but `-S` would.
> Indeed I am using sometimes `-flto -S` and I expect IR, that's what is the
> most logical to me considering what -c does.
>
>
> http://reviews.llvm.org/D21006
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Duncan P. N. Exon Smith via cfe-commits
I agree with Mehdi.  I expect `-S -flto` to give equivalent output to `-c 
-flto`.

In effect, with this change, `-flto -S` would silently ignore the `-flto` flag. 
 That doesn't make sense to me.

> On 2016-Jun-05, at 18:28, Mehdi AMINI  wrote:
> 
> mehdi_amini added a comment.
> 
> What makes me not comfortable with this change is that after that  `-c` would 
> not involves codegen but `-S` would.
> Indeed I am using sometimes `-flto -S` and I expect IR, that's what is the 
> most logical to me considering what -c does.
> 
> 
> http://reviews.llvm.org/D21006
> 
> 
> 

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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith added a subscriber: dexonsmith.
dexonsmith added a comment.

I agree with Mehdi.  I expect `-S -flto` to give equivalent output to `-c 
-flto`.

In effect, with this change, `-flto -S` would silently ignore the `-flto` flag. 
 That doesn't make sense to me.


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

What makes me not comfortable with this change is that after that  `-c` would 
not involves codegen but `-S` would.
Indeed I am using sometimes `-flto -S` and I expect IR, that's what is the most 
logical to me considering what -c does.


http://reviews.llvm.org/D21006



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


Re: r271692 - Don't pass --build-id to ld by default.

2016-06-05 Thread Nico Weber via cfe-commits
lgtm

On Sun, Jun 5, 2016 at 3:31 PM, Rafael Espíndola  wrote:

> Patch attached. What do you think?
>
> Cheers,
> Rafael
>
>
> On 3 June 2016 at 16:11, Ed Maste  wrote:
> > On 3 June 2016 at 15:53, Nico Weber via cfe-commits
> >  wrote:
> >> Can you add this to the release notes? It'll for example break
> chromium's
> >> crash server (we can fix this on our end by explicitly passing
> >> -Wl,--build-id for release builds, but we only saw this commit fly by by
> >> chance.)
> >
> > Good point. The Debian, SUSE, Redhat and Ubuntu package maintainers
> > will also have to update their package build recipes and we want to
> > make sure they don't miss the change.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Espíndola via cfe-commits
OK, it prints assembly with ir in it. That doesn't apply to us since .BC is
not elf.

I guess we could just produce assembly. A .ll  cannot be used for lto.

So I guess this is OK, but please wait to see what others think.

Cheers,
Rafael
On Jun 5, 2016 7:45 PM, "Davide Italiano"  wrote:

> davide added a comment.
>
> In http://reviews.llvm.org/D21006#449380, @rafael wrote:
>
> > Can you check what GCC does?
>
>
> Sure.
>
>   $ gcc flto.c -o flto.o -flto -S && cat flto.o |head -n 15
> .file   "flto.c"
> .section.gnu.lto_.inline.513e7babbe55b1f8,"e",@progbits
> .string "x\234ca\200"
> .string "\021\006\004`d``af``b\371\240\307\300\302\300\004\026\003"
> .ascii  "\020b\001K"
> .text
> .section.gnu.lto_foo.513e7babbe55b1f8,"e",@progbits
> .string
> "x\234eP\275J\003A\020\236o\346\210Q8\365\001R\244\t!\026>C\360\021|\005A\033\341\032\373\254\\\"QA,\242\210X\004LH\341O\022[\213\004\004\021\301\"\202\235EPQ\320&\207\212\225\2363I#8\260;3\314\3673\273\036\215b\016D\276\346\2245\036\201I\017Do\201\216\bT`A\001\237\374\315\350\025[\007\362\301%!x\332F7\373\217\223\326\002im_j[{\3105\234F\277^Inl\243$L1\023\216\221\302\021\314\002'\310)\264z\365v\351\313\004H\353\316m\271\346e\353Fs\347y7\256$\234B\376\362L\007Md\r\376\320\376\331\361\023EC\247M\\5[H\350\252\320a\377\375\372\"\2319t\256\354\334W\267\n\267\236\377\277\203B\333\3104\347\273.\216C\347\356\322\360"
> .ascii
> "\223\347\241\021\rL\224\"\326$\317\bw\327\356\305,B\341P\314"
> .ascii
> "\244\321\253lN\331\263\03138\033JF\254?&OX\235&\247\325\253~"
> .ascii
> "\341\210aJ\003\326\355\264\032[\\^\tf\027H\226\202\340\027\253"
> .ascii  "\277d'"
> .text
> .section
> .gnu.lto_.symbol_nodes.513e7babbe55b1f8,"e",@progbits
> .string "x\234ca``\020\006b\006&\206z\006\206\t\347\030@
> \324\252FE\240\b"
>
>
> http://reviews.llvm.org/D21006
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Ávila de Espíndola via cfe-commits
rafael added a comment.

OK, it prints assembly with ir in it. That doesn't apply to us since .BC is
not elf.

I guess we could just produce assembly. A .ll  cannot be used for lto.

So I guess this is OK, but please wait to see what others think.

Cheers,
Rafael


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449380, @rafael wrote:

> Can you check what GCC does?


Sure.

  $ gcc flto.c -o flto.o -flto -S && cat flto.o |head -n 15
.file   "flto.c"
.section.gnu.lto_.inline.513e7babbe55b1f8,"e",@progbits
.string "x\234ca\200"
.string "\021\006\004`d``af``b\371\240\307\300\302\300\004\026\003"
.ascii  "\020b\001K"
.text
.section.gnu.lto_foo.513e7babbe55b1f8,"e",@progbits
.string 
"x\234eP\275J\003A\020\236o\346\210Q8\365\001R\244\t!\026>C\360\021|\005A\033\341\032\373\254\\\"QA,\242\210X\004LH\341O\022[\213\004\004\021\301\"\202\235EPQ\320&\207\212\225\2363I#8\260;3\314\3673\273\036\215b\016D\276\346\2245\036\201I\017Do\201\216\bT`A\001\237\374\315\350\025[\007\362\301%!x\332F7\373\217\223\326\002im_j[{\3105\234F\277^Inl\243$L1\023\216\221\302\021\314\002'\310)\264z\365v\351\313\004H\353\316m\271\346e\353Fs\347y7\256$\234B\376\362L\007Md\r\376\320\376\331\361\023EC\247M\\5[H\350\252\320a\377\375\372\"\2319t\256\354\334W\267\n\267\236\377\277\203B\333\3104\347\273.\216C\347\356\322\360"
.ascii  "\223\347\241\021\rL\224\"\326$\317\bw\327\356\305,B\341P\314"
.ascii  "\244\321\253lN\331\263\03138\033JF\254?&OX\235&\247\325\253~"
.ascii  "\341\210aJ\003\326\355\264\032[\\^\tf\027H\226\202\340\027\253"
.ascii  "\277d'"
.text
.section.gnu.lto_.symbol_nodes.513e7babbe55b1f8,"e",@progbits
.string 
"x\234ca``\020\006b\006&\206z\006\206\t\347\030@\324\252FE\240\b"


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Ávila de Espíndola via cfe-commits
rafael added a subscriber: rafael.
rafael added a comment.

Can you check what GCC does?


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Rafael Espíndola via cfe-commits
Can you check what GCC does?
On Jun 5, 2016 6:40 PM, "Mehdi AMINI"  wrote:

> mehdi_amini added a comment.
>
> Duncan CC for opinion.
>
>
> http://reviews.llvm.org/D21006
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

Duncan CC for opinion.


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide added a comment.

In http://reviews.llvm.org/D21006#449365, @mehdi_amini wrote:

> I'm not sure it is consistent with how we handle -flto, for instance -c means 
> usually to output an object file, but adding -flto indicates to dump bitcode 
> instead.


I see two alternative approaches:

1. Force all the downstream consumers to pass -fno-lto (as I'm doing right now) 
together with -S. I don't like this option.
2. Make -flto and -S incompatible (and add a warning or an error) and have 
people that really want to emit llvm to use -emit-llvm instead?


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

I'm not sure it is consistent with how we handle -flto, for instance -c means 
usually to output an object file, but adding -flto indicates to dump bitcode 
instead.


http://reviews.llvm.org/D21006



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


Re: [PATCH] D21006: [Driver] Make -flto -S emit assembly

2016-06-05 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 59679.
davide added a comment.

Add a test, fix a typo.


http://reviews.llvm.org/D21006

Files:
  lib/Driver/Driver.cpp
  test/CodeGen/2009-10-20-GlobalDebug.c
  test/CodeGen/emit-asm.c
  test/CodeGenCXX/cxx-apple-kext.cpp
  test/Driver/darwin-iphone-defaults.m
  test/Driver/darwin-objc-gc.m

Index: test/Driver/darwin-objc-gc.m
===
--- test/Driver/darwin-objc-gc.m
+++ test/Driver/darwin-objc-gc.m
@@ -1,6 +1,6 @@
 // Check that we warn, but accept, -fobjc-gc for iPhone OS.
 
-// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -stdlib=platform -fobjc-gc -flto -S -o %t %s 2> %t.err
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -stdlib=platform -fobjc-gc -flto -S -emit-llvm -o %t %s 2> %t.err
 // RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_LL %s < %t 
 // RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_STDERR %s < %t.err
 
Index: test/Driver/darwin-iphone-defaults.m
===
--- test/Driver/darwin-iphone-defaults.m
+++ test/Driver/darwin-iphone-defaults.m
@@ -1,4 +1,4 @@
-// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -stdlib=platform -flto -S -o - %s | FileCheck %s
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -stdlib=platform -flto -S -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: @f0() [[F0:#[0-9]+]]
 // CHECK: @__f0_block_invoke
Index: test/CodeGenCXX/cxx-apple-kext.cpp
===
--- test/CodeGenCXX/cxx-apple-kext.cpp
+++ test/CodeGenCXX/cxx-apple-kext.cpp
@@ -1,7 +1,7 @@
-// RUN: %clangxx -target x86_64-apple-darwin10 %s -flto -S -o - |\
+// RUN: %clangxx -target x86_64-apple-darwin10 %s -flto -S -emit-llvm -o - |\
 // RUN:   FileCheck --check-prefix=CHECK-NO-KEXT %s
-// RUN: %clangxx -target x86_64-apple-darwin10 %s -fapple-kext -flto -S -o - |\
-// RUN:   FileCheck --check-prefix=CHECK-KEXT %s
+// RUN: %clangxx -target x86_64-apple-darwin10 %s -fapple-kext -flto -S \
+// RUN:   -emit-llvm -o - | FileCheck --check-prefix=CHECK-KEXT %s
 
 // CHECK-NO-KEXT-NOT: _GLOBAL__D_a
 // CHECK-NO-KEXT: @is_hosted = global
Index: test/CodeGen/emit-asm.c
===
--- test/CodeGen/emit-asm.c
+++ test/CodeGen/emit-asm.c
@@ -0,0 +1,15 @@
+// Make sure ASM is emitted instead of LLVM IR.
+// RUN: %clang_cc1 %s -S -flto -o - | FileCheck %s
+
+int foo(int goo) { return goo + 42; }
+
+// CHECK:   .section  __TEXT,__text,regular,pure_instructions
+// CHECK:   .macosx_version_min 10, 11
+// CHECK:   .globl  _foo
+// CHECK:   .p2align  4, 0x90
+// CHECK: _foo:
+// CHECK:   movl  %edi, -4(%rsp)
+// CHECK:   movl  -4(%rsp), %edi
+// CHECK:   addl  $42, %edi
+// CHECK:   movl  %edi, %eax
+// CHECK:   retq
Index: test/CodeGen/2009-10-20-GlobalDebug.c
===
--- test/CodeGen/2009-10-20-GlobalDebug.c
+++ test/CodeGen/2009-10-20-GlobalDebug.c
@@ -1,16 +1,17 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang -target i386-apple-darwin10 -flto -S -g %s -o - | FileCheck %s
+// RUN: %clang -target i386-apple-darwin10 -flto -emit-llvm -S -g %s -o - |\
+// RUN:FileCheck %s
 int global;
 int main() { 
   static int localstatic;
   return 0;
 }
 
 // CHECK: !DIGlobalVariable(name: "localstatic"
 // CHECK-NOT:   linkageName:
-// CHECK-SAME:  line: 5,
+// CHECK-SAME:  line: 6,
 // CHECK-SAME:  variable: i32* @main.localstatic
 // CHECK: !DIGlobalVariable(name: "global"
 // CHECK-NOT:   linkageName:
-// CHECK-SAME:  line: 3,
+// CHECK-SAME:  line: 4,
 // CHECK-SAME:  variable: i32* @global
Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -1746,8 +1746,15 @@
   }
   case phases::Backend: {
 if (isUsingLTO()) {
-  types::ID Output =
-  Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
+  // -flto in conjunction with -S will still produce
+  // assembler, unless -emit-llvm is also specified.
+  // In that case, LLVM IR is produced instead.
+  types::ID Output;
+  if (Args.hasArg(options::OPT_S))
+Output = (Args.hasArg(options::OPT_emit_llvm)) ? types::TY_LLVM_IR :
+types::TY_PP_Asm;
+  else
+Output = types::TY_LTO_BC;
   return C.MakeAction(Input, Output);
 }
 if (Args.hasArg(options::OPT_emit_llvm)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.

2016-06-05 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20687#449312, @hintonda wrote:

> This marcher was recently added, and has never been in a release.  
> Specifically, it was added by me in support of a checker that has now been 
> abandoned in lieu of a better approach -- the new approach requires this 
> change -- so I doubt it would break anything.


That's good to know, thanks!

> That said, I will look into polymorphic matchers if that is the preferred 
> solution.


Thank you -- I think that is still the right approach to take. We try to keep 
the matchers as close to the AST representation as possible, and this one (plus 
isNoThrow()) slipped through the cracks (in a useful way).


http://reviews.llvm.org/D20687



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


Re: [PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.

2016-06-05 Thread don hinton via cfe-commits
hintonda added a comment.

This marcher was recently added, and has never been in a release.  
Specifically, it was added by me in support of a checker that has now been 
abandoned in lieu of a better approach -- the new approach requires this change 
-- so I doubt it would break anything.

That said, I will look into polymorphic matchers if that is the preferred 
solution.


http://reviews.llvm.org/D20687



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


Re: r271692 - Don't pass --build-id to ld by default.

2016-06-05 Thread Rafael Espíndola via cfe-commits
Patch attached. What do you think?

Cheers,
Rafael


On 3 June 2016 at 16:11, Ed Maste  wrote:
> On 3 June 2016 at 15:53, Nico Weber via cfe-commits
>  wrote:
>> Can you add this to the release notes? It'll for example break chromium's
>> crash server (we can fix this on our end by explicitly passing
>> -Wl,--build-id for release builds, but we only saw this commit fly by by
>> chance.)
>
> Good point. The Debian, SUSE, Redhat and Ubuntu package maintainers
> will also have to update their package build recipes and we want to
> make sure they don't miss the change.
From e803bb8f8f9bf5d4cea513e489fabce5e96a5658 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
 
Date: Sun, 5 Jun 2016 15:30:13 -0400
Subject: [PATCH] Add a release not about --build-id.

---
 docs/ReleaseNotes.rst | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index bcf67ec..376b4c7 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -47,7 +47,10 @@ sections with improvements to Clang's support for those languages.
 Major New Features
 --
 
-- Feature1...
+- Clang will no longer passes --build-id by default to the linker. In modern
+  linkers that is a relatively expensive option. It can be passed explicitly
+  with -Wl,--build-id. To have clang always pass it, build it with
+  -DENABLE_LINKER_BUILD_ID.
 
 Improvements to Clang's diagnostics
 ^^^
-- 
2.5.5

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


[cfe-commitsatlists.llvm.org: r271801 - Add PIE magic for NetBSD. Add tests for the correct flags for]

2016-06-05 Thread Joerg Sonnenberger via cfe-commits
Hi Tom,
I'd like to merge this change for getting rid of the stupid '-pie is
nont used' warnings and to actual make it do the right thing :) This
doesn't affect any other targets.

Joerg

- Forwarded message from Joerg Sonnenberger via cfe-commits 
 -

Author: joerg
Date: Sat Jun  4 15:03:26 2016
New Revision: 271801

URL: http://llvm.org/viewvc/llvm-project?rev=271801&view=rev
Log:
Add PIE magic for NetBSD. Add tests for the correct flags for
non-shared, PIE and shared output mode.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/netbsd.c

- End forwarded message -
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.

2016-06-05 Thread Aaron Ballman via cfe-commits
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.

Sorry for the delayed response, this review got lost in my inbox!

This change will break existing out-of-tree users and would be a regression. 
Instead, the matcher should become a polymorphic matcher that accepts a 
FunctionDecl as well as a FunctionType. Check out the matcher for isConstexpr() 
to see how to create a polymorphic matcher. Note that you may need to use a 
trick like the one used in hasAnySubstatement() to handle the differences 
between getting the exception spec from a FunctionDecl and a FunctionType from 
the same matcher.

Also, can you update isNoThrow() at the same time? It has the similar behavior 
of currently working only on a FunctionDecl and not a FunctionType.

Finally, I'm wondering whether we want this to work on a FunctionType or a 
FunctionProtoType. Only functions with prototypes can have an exception 
specification, so putting the functionality on FunctionProtoType keeps it 
closer to the AST representation. However, this also may make it slightly more 
awkward to use in practice. Thoughts?


http://reviews.llvm.org/D20687



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


r271836 - Fixing problem with rsqrt28_sd

2016-06-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Sun Jun  5 10:57:49 2016
New Revision: 271836

URL: http://llvm.org/viewvc/llvm-project?rev=271836&view=rev
Log:
Fixing problem with rsqrt28_sd

maskz_rsqrt28_sd mapped to mask_rsqrt28_sd and not to the maskz.



Modified:
cfe/trunk/lib/Headers/avx512erintrin.h

Modified: cfe/trunk/lib/Headers/avx512erintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512erintrin.h?rev=271836&r1=271835&r2=271836&view=diff
==
--- cfe/trunk/lib/Headers/avx512erintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512erintrin.h Sun Jun  5 10:57:49 2016
@@ -177,7 +177,7 @@
   _mm_mask_rsqrt28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
 
 #define _mm_maskz_rsqrt28_sd(M, A, B) \
-  _mm_mask_rsqrt28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
+  _mm_maskz_rsqrt28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
 
 // rcp28
 #define _mm512_rcp28_round_pd(A, R) __extension__ ({ \


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


Re: [PATCH] D20866: [Clang][AVX512]Adding set4 intrinsics

2016-06-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271835: [Clang][AVX512]Adding set4 intrinsics (authored by 
mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D20866?vs=59379&id=59667#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20866

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -6236,6 +6236,62 @@
   return _mm512_set1_epi16(d);
 }
 
+__m512i test_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi32 
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_set4_epi32 (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_set4_epi64 (long long __A, long long __B, long long __C, long long __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi64 
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_set4_epi64 (__A,__B,__C,__D);
+}
+
+__m512d test_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_pd 
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_set4_pd (__A,__B,__C,__D);
+}
+
+__m512 test_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_ps 
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_set4_ps (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_setr4_epi32(int e0, int e1, int e2, int e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi32
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_setr4_epi32(e0, e1, e2, e3);
+}
+
+ __m512i test_mm512_setr4_epi64(long long e0, long long e1, long long e2, long long e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi64
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_setr4_epi64(e0, e1, e2, e3);
+}
+
+__m512i test_mm512_setr4_pd(double e0, double e1, double e2, double e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_pd
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_setr4_pd(e0,e1,e2,e3);
+}
+
+ __m512i test_mm512_setr4_ps(float e0, float e1, float e2, float e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_ps
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_setr4_ps(e0,e1,e2,e3);
+}
+
 __m512d test_mm512_castpd256_pd512(__m256d a)
 {
   // CHECK-LABEL: @test_mm512_castpd256_pd512
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -343,6 +343,49 @@
 __f, __f, __f, __f };
 }
 
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  return  (__m512i)(__v16si)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi64 (long long __A, long long __B, long long __C,
+   long long __D)
+{
+  return  (__m512i) (__v8di)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  return  (__m512d)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  return  (__m512)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+#define _mm512_setr4_epi32(e0,e1,e2,e3)   \
+  _mm512_set4_epi32(e3,e2,e1,e0)
+
+#define _mm512_setr4_epi64(e0,e1,e2,e3)   \
+  _mm512_set4_epi64(e3,e2,e1,e0)
+
+#define _mm512_setr4_pd(e0,e1,e2,e3)\
+  _mm512_set4_pd(e3,e2,e1,e0)
+
+#define _mm512_setr4_ps(e0,e1,e2,e3)\
+  _mm512_set4_ps(e3,e2,e1,e0)
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_broadcastsd_pd(__m128d __X)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271835 - [Clang][AVX512]Adding set4 intrinsics

2016-06-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Sun Jun  5 10:43:30 2016
New Revision: 271835

URL: http://llvm.org/viewvc/llvm-project?rev=271835&view=rev
Log:
[Clang][AVX512]Adding set4 intrinsics

Differential Revision: http://reviews.llvm.org/D20866

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271835&r1=271834&r2=271835&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Sun Jun  5 10:43:30 2016
@@ -343,6 +343,49 @@ _mm512_broadcastss_ps(__m128 __X)
 __f, __f, __f, __f };
 }
 
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  return  (__m512i)(__v16si)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set4_epi64 (long long __A, long long __B, long long __C,
+   long long __D)
+{
+  return  (__m512i) (__v8di)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  return  (__m512d)
+   { __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  return  (__m512)
+   { __D, __C, __B, __A, __D, __C, __B, __A,
+ __D, __C, __B, __A, __D, __C, __B, __A };
+}
+
+#define _mm512_setr4_epi32(e0,e1,e2,e3)   \
+  _mm512_set4_epi32(e3,e2,e1,e0)
+
+#define _mm512_setr4_epi64(e0,e1,e2,e3)   \
+  _mm512_set4_epi64(e3,e2,e1,e0)
+
+#define _mm512_setr4_pd(e0,e1,e2,e3)\
+  _mm512_set4_pd(e3,e2,e1,e0)
+
+#define _mm512_setr4_ps(e0,e1,e2,e3)\
+  _mm512_set4_ps(e3,e2,e1,e0)
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_broadcastsd_pd(__m128d __X)
 {

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=271835&r1=271834&r2=271835&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Sun Jun  5 10:43:30 2016
@@ -6236,6 +6236,62 @@ __m512d test_mm512_set1_epi16(short d)
   return _mm512_set1_epi16(d);
 }
 
+__m512i test_mm512_set4_epi32 (int __A, int __B, int __C, int __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi32 
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_set4_epi32 (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_set4_epi64 (long long __A, long long __B, long long __C, 
long long __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_epi64 
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_set4_epi64 (__A,__B,__C,__D);
+}
+
+__m512d test_mm512_set4_pd (double __A, double __B, double __C, double __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_pd 
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_set4_pd (__A,__B,__C,__D);
+}
+
+__m512 test_mm512_set4_ps (float __A, float __B, float __C, float __D)
+{
+  // CHECK-LABEL: @test_mm512_set4_ps 
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_set4_ps (__A,__B,__C,__D);
+}
+
+__m512i test_mm512_setr4_epi32(int e0, int e1, int e2, int e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi32
+  // CHECK: insertelement <16 x i32> {{.*}}, i32 15
+  return _mm512_setr4_epi32(e0, e1, e2, e3);
+}
+
+ __m512i test_mm512_setr4_epi64(long long e0, long long e1, long long e2, long 
long e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_epi64
+  // CHECK: insertelement <8 x i64> {{.*}}, i32 7
+  return _mm512_setr4_epi64(e0, e1, e2, e3);
+}
+
+__m512i test_mm512_setr4_pd(double e0, double e1, double e2, double e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_pd
+  // CHECK: insertelement <8 x double> {{.*}}, i32 7
+  return _mm512_setr4_pd(e0,e1,e2,e3);
+}
+
+ __m512i test_mm512_setr4_ps(float e0, float e1, float e2, float e3)
+{
+  // CHECK-LABEL: @test_mm512_setr4_ps
+  // CHECK: insertelement <16 x float> {{.*}}, i32 15
+  return _mm512_setr4_ps(e0,e1,e2,e3);
+}
+
 __m512d test_mm512_castpd256_pd512(__m256d a)
 {
   // CHECK-LABEL: @test_mm512_castpd256_pd512


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


Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-05 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271832: [Clang][AVX512][Intrinsics] Adding two definitions 
_mm512_setzero and… (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D20871?vs=59659&id=59665#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20871

Files:
  cfe/trunk/lib/Headers/avx512fintrin.h
  cfe/trunk/test/CodeGen/avx512f-builtins.c

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -7343,3 +7343,38 @@
   return _mm_maskz_cvtsd_ss(__U, __A, __B); 
 }
 
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
+
+__m512i test_mm512_setzero_si512()
+{
+  // CHECK-LABEL: @test_mm512_setzero_si512
+  // CHECK: zeroinitializer
+  return _mm512_setzero_si512();
+}
+
+__m512i test_mm512_setzero_ps()
+{
+  // CHECK-LABEL: @test_mm512_setzero_ps
+  // CHECK: zeroinitializer
+  return _mm512_setzero_ps();
+}
+
+__m512d test_mm512_setzero_pd()
+{
+  // CHECK-LABEL: @test_mm512_setzero_pd
+  // CHECK: zeroinitializer
+  return _mm512_setzero_pd();
+}
\ No newline at end of file
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -170,6 +170,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -274,6 +276,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {


Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -7343,3 +7343,38 @@
   return _mm_maskz_cvtsd_ss(__U, __A, __B); 
 }
 
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
+
+__m512i test_mm512_setzero_si512()
+{
+  // CHECK-LABEL: @test_mm512_setzero_si512
+  // CHECK: zeroinitializer
+  return _mm512_setzero_si512();
+}
+
+__m512i test_mm512_setzero_ps()
+{
+  // CHECK-LABEL: @test_mm512_setzero_ps
+  // CHECK: zeroinitializer
+  return _mm512_setzero_ps();
+}
+
+__m512d test_mm512_setzero_pd()
+{
+  // CHECK-LABEL: @test_mm512_setzero_pd
+  // CHECK: zeroinitializer
+  return _mm512_setzero_pd();
+}
\ No newline at end of file
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -170,6 +170,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -274,6 +276,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r271832 - [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-05 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Sun Jun  5 10:12:52 2016
New Revision: 271832

URL: http://llvm.org/viewvc/llvm-project?rev=271832&view=rev
Log:
[Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and 
_mm512_setzero_epi32

Differential Revision: http://reviews.llvm.org/D20871

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=271832&r1=271831&r2=271832&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Sun Jun  5 10:12:52 2016
@@ -170,6 +170,8 @@ _mm512_setzero_si512(void)
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -274,6 +276,9 @@ _mm512_setzero_ps(void)
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=271832&r1=271831&r2=271832&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Sun Jun  5 10:12:52 2016
@@ -7343,3 +7343,38 @@ __m128 test_mm_maskz_cvtsd_ss(__mmask8 _
   return _mm_maskz_cvtsd_ss(__U, __A, __B); 
 }
 
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
+
+__m512i test_mm512_setzero_si512()
+{
+  // CHECK-LABEL: @test_mm512_setzero_si512
+  // CHECK: zeroinitializer
+  return _mm512_setzero_si512();
+}
+
+__m512i test_mm512_setzero_ps()
+{
+  // CHECK-LABEL: @test_mm512_setzero_ps
+  // CHECK: zeroinitializer
+  return _mm512_setzero_ps();
+}
+
+__m512d test_mm512_setzero_pd()
+{
+  // CHECK-LABEL: @test_mm512_setzero_pd
+  // CHECK: zeroinitializer
+  return _mm512_setzero_pd();
+}
\ No newline at end of file


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


[PATCH] D21002: [Clang][AVX512][BUILTIN]Adding intrinsics for range_round_{sd|ss}

2016-06-05 Thread michael zuckerman via cfe-commits
m_zuckerman created this revision.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: cfe-commits.

http://reviews.llvm.org/D21002

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/avx512dqintrin.h
  test/CodeGen/avx512dq-builtins.c

Index: test/CodeGen/avx512dq-builtins.c
===
--- test/CodeGen/avx512dq-builtins.c
+++ test/CodeGen/avx512dq-builtins.c
@@ -635,6 +635,42 @@
   return _mm512_maskz_range_round_pd(__U, __A, __B, 4, 8); 
 }
 
+__m128d test_mm512_range_round_sd(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm512_range_round_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_range_round_sd(__A, __B, 4, 8); 
+}
+
+__m128d test_mm512_mask_range_round_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: test_mm512_mask_range_round_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_mask_range_round_sd(__W, __U, __A, __B, 4, 8); 
+}
+
+__m128d test_mm512_maskz_range_round_sd(__mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm512_maskz_range_round_sd
+  // CHECK: @llvm.x86.avx512.mask.range.sd
+  return _mm_maskz_range_round_sd(__U, __A, __B, 4, 8); 
+}
+
+__m128d test_mm512_range_round_ss(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm512_range_round_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_range_round_ss(__A, __B, 4, 8); 
+}
+
+__m128d test_mm512_mask_range_round_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm512_mask_range_round_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_mask_range_round_ss(__W, __U, __A, __B, 4, 8); 
+}
+
+__m128 test_mm512_maskz_range_round_ss(__mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm512_maskz_range_round_ss
+  // CHECK: @llvm.x86.avx512.mask.range.ss
+  return _mm_maskz_range_round_ss(__U, __A, __B, 4, 8); 
+}
+
 __m512 test_mm512_range_ps(__m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_range_ps
   // CHECK: @llvm.x86.avx512.mask.range.ps.512
Index: lib/Headers/avx512dqintrin.h
===
--- lib/Headers/avx512dqintrin.h
+++ lib/Headers/avx512dqintrin.h
@@ -785,6 +785,42 @@
  (__v16sf)_mm512_setzero_ps(), \
  (__mmask16)(U), (int)(R)); })
 
+#define _mm_range_round_ss(A, B, C, R) __extension__ ({   \
+  (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
+  (__v4sf)(__m128)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8) -1,(int)(C), (int)(R));})
+
+#define _mm_mask_range_round_ss(W, U, A, B, C, R) __extension__ ({ \
+  (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
+  (__v4sf)(__m128)(B), \
+  (__v4sf)(__m128)(W),\
+  (__mmask8)(U), (int)(C), (int)(R)); })
+
+#define _mm_maskz_range_round_ss(U, A, B, C, R) __extension__ ({ \
+  (__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
+  (__v4sf)(__m128)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8)(U),(int)(C), (int)(R));})
+
+#define _mm_range_round_sd(A, B, C, R) __extension__ ({   \
+  (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128)(A), \
+  (__v2df)(__m128)(B), \
+  (__v2df)_mm_setzero_pd(), \
+  (__mmask8) -1, (int)(C), (int)(R));})
+
+#define _mm_mask_range_round_sd(W, U, A, B, C, R) __extension__ ({ \
+  (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
+  (__v2df)(__m128d)(B), \
+  (__v2df)(__m128d)(W), (__mmask8)(U), \
+  (int)(C), (int)(R));})
+
+#define _mm_maskz_range_round_sd(U, A, B, C, R) __extension__ ({ \
+  (__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
+  (__v2df)(__m128d)(B), \
+  (__v2df)_mm_setzero_pd(), \
+  (__mmask8)(U),(int)(C), (int)(R));})
+
 #define _mm512_reduce_pd(A, B) __extension__ ({ \
   (__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
(__v8df)_mm512_setzero_pd(), \
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -1

Re: [PATCH] D20866: [Clang][AVX512]Adding set4 intrinsics

2016-06-05 Thread Asaf Badouh via cfe-commits
AsafBadouh accepted this revision.
AsafBadouh added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D20866



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


Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps

2016-06-05 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 59663.

http://reviews.llvm.org/D20626

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -1972,10 +1972,15 @@
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
   return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
-__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d 
__B) {
-  // CHECK-LABEL: @test_mm512_mask_div_pd
+__m512d test_mm512_div_pd(__m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_div_pd
+  // CHECK: fdiv <8 x double>
+  return _mm512_div_pd(__a,__b); 
+}
+__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d 
__b) {
+  // CHECK-LABLE: @test_mm512_mask_div_pd
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
-  return _mm512_mask_div_pd(__W,__U,__A,__B); 
+  return _mm512_mask_div_pd(__w,__u,__a,__b); 
 }
 __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_div_pd
@@ -1997,6 +2002,11 @@
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
   return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
+__m512 test_mm512_div_ps(__m512 __A, __m512 __B) {
+  // CHECK-LABEL: @test_mm512_div_ps
+  // CHECK: fdiv <16 x float>
+  return _mm512_div_ps(__A,__B); 
+}
 __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 
__B) {
   // CHECK-LABEL: @test_mm512_mask_div_ps
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -2422,6 +2422,12 @@
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_div_pd(__m512d __a, __m512d __b)
+{
+  return (__m512d)((__v8df)__a/(__v8df)__b);
+}
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
   return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A,
@@ -2441,6 +2447,12 @@
  _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_div_ps(__m512 __a, __m512 __b)
+{
+  return (__m512)((__v16sf)__a/(__v16sf)__b);
+}
+
 static __inline__ __m512 __DEFAULT_FN_ATTRS
 _mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   return (__m512) __builtin_ia32_divps512_mask ((__v16sf) __A,


Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -1972,10 +1972,15 @@
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
   return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
-__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
-  // CHECK-LABEL: @test_mm512_mask_div_pd
+__m512d test_mm512_div_pd(__m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_div_pd
+  // CHECK: fdiv <8 x double>
+  return _mm512_div_pd(__a,__b); 
+}
+__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d __b) {
+  // CHECK-LABLE: @test_mm512_mask_div_pd
   // CHECK: @llvm.x86.avx512.mask.div.pd.512
-  return _mm512_mask_div_pd(__W,__U,__A,__B); 
+  return _mm512_mask_div_pd(__w,__u,__a,__b); 
 }
 __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) {
   // CHECK-LABEL: @test_mm512_maskz_div_pd
@@ -1997,6 +2002,11 @@
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
   return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); 
 }
+__m512 test_mm512_div_ps(__m512 __A, __m512 __B) {
+  // CHECK-LABEL: @test_mm512_div_ps
+  // CHECK: fdiv <16 x float>
+  return _mm512_div_ps(__A,__B); 
+}
 __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
   // CHECK-LABEL: @test_mm512_mask_div_ps
   // CHECK: @llvm.x86.avx512.mask.div.ps.512
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -2422,6 +2422,12 @@
(__v2df)_mm_setzero_pd(), \
(__mmask8)(U), (int)(R)); })
 
+static __inline __m512d __DEFAULT_FN_ATTRS
+_mm512_div_pd(__m512d __a, __m512d __b)
+{
+  return (__m512d)((__v8df)__a/(__v8df)__b);
+}
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
   return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A,
@@ -2441,6 +2447,12 @@
  _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline __m512 __DEFAULT_FN_ATTRS
+_mm512_div_ps(__m512 __a,

Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-05 Thread Simon Pilgrim via cfe-commits
RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM - add test_mm512_setzero_pd() as well if you can.



Comment at: test/CodeGen/avx512f-builtins.c:7291
@@ +7290,3 @@
+
+__m512i test_mm512_setzero_ps()
+{

__m512d test_mm512_setzero_pd() ?


http://reviews.llvm.org/D20871



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


Re: [PATCH] D20196: [clang-tidy] Inefficient string operation

2016-06-05 Thread Bittner Barni via cfe-commits
bittnerbarni updated this revision to Diff 59661.
bittnerbarni marked 6 inline comments as done.
bittnerbarni added a comment.

Removed the unnecessary hasDescendant calls and simplified the checker as 
suggested. Tested on LLVM codebase, with minor improvements in speed (~1%).


http://reviews.llvm.org/D20196

Files:
  clang-tidy/performance/CMakeLists.txt
  clang-tidy/performance/InefficientStringConcatenationCheck.cpp
  clang-tidy/performance/InefficientStringConcatenationCheck.h
  clang-tidy/performance/PerformanceTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  test/clang-tidy/performance-inefficient-string-concatenation.cpp

Index: test/clang-tidy/performance-inefficient-string-concatenation.cpp
===
--- /dev/null
+++ test/clang-tidy/performance-inefficient-string-concatenation.cpp
@@ -0,0 +1,44 @@
+// RUN: %check_clang_tidy %s performance-inefficient-string-concatenation %t
+
+namespace std {
+template 
+class basic_string {
+public:
+  basic_string() {}
+  ~basic_string() {}
+  basic_string *operator+=(const basic_string &) {}
+  friend basic_string operator+(const basic_string &, const basic_string &) {}
+};
+typedef basic_string string;
+typedef basic_string wstring;
+}
+
+void f(std::string) {}
+std::string g(std::string) {}
+
+int main() {
+  std::string mystr1, mystr2;
+  std::wstring mywstr1, mywstr2;
+
+  for (int i = 0; i < 10; ++i) {
+f(mystr1 + mystr2 + mystr1);
+// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead
+mystr1 = mystr1 + mystr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: string concatenation
+mystr1 = mystr2 + mystr2 + mystr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: string concatenation
+mystr1 = mystr2 + mystr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: string concatenation
+mywstr1 = mywstr2 + mywstr1;
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: string concatenation
+mywstr1 = mywstr2 + mywstr2 + mywstr2;
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: string concatenation
+
+mywstr1 = mywstr2 + mywstr2;
+mystr1 = mystr2 + mystr2;
+mystr1 += mystr2;
+f(mystr2 + mystr1);
+mystr1 = g(mystr1);
+  }
+  return 0;
+}
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -0,0 +1,49 @@
+.. title:: clang-tidy - performance-inefficient-string-concatenation
+
+performance-inefficient-string-concatenation
+
+
+This check warns about the performance overhead arising from concatenating strings using the ``operator+``, for instance:
+
+.. code:: c++
+
+std::string a("Foo"), b("Bar");
+a = a + b;
+
+Instead of this structure you should use ``operator+=`` or ``std::string``'s (``std::basic_string``) class member function ``append()``. For instance:
+   
+.. code:: c++
+
+   std::string a("Foo"), b("Baz");
+   for (int i = 0; i < 2; ++i) {
+   a = a + "Bar" + b;
+   }
+
+Could be rewritten in a greatly more efficient way like:
+
+.. code:: c++
+
+   std::string a("Foo"), b("Baz");
+   for (int i = 0; i < 2; ++i) {
+   a.append("Bar").append(b);
+   } 
+
+And this can be rewritten too:
+
+.. code:: c++
+
+   void f(const std::string&) {}
+   std::string a("Foo"), b("Baz");
+   void g() {
+   f(a + "Bar" + b);
+   }
+
+In a slightly more efficient way like:
+
+.. code:: c++
+
+   void f(const std::string&) {}
+   std::string a("Foo"), b("Baz");
+   void g() {
+   f(std::string(a).append("Bar").append(b));
+   }
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -102,6 +102,7 @@
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
+   performance-inefficient-string-concatenation
performance-unnecessary-copy-initialization
performance-unnecessary-value-param
readability-avoid-const-params-in-decls
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -184,6 +184,12 @@
   Warns about range-based loop with a loop variable of const ref type where the
   type of the variable does not match the one returned by the iterator.
 
+- New `performance-inefficient-string-concatenation
+  `_ check
+
+  This check is to warn about the performance overhead arising from concatenating 
+  strings, using the `

Re: [PATCH] D20871: [Clang][AVX512][Intrinsics] Adding two definitions _mm512_setzero and _mm512_setzero_epi32

2016-06-05 Thread michael zuckerman via cfe-commits
m_zuckerman updated this revision to Diff 59659.

http://reviews.llvm.org/D20871

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -7266,3 +7266,31 @@
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
+
+__m512i test_mm512_setzero_si512()
+{
+  // CHECK-LABEL: @test_mm512_setzero_si512
+  // CHECK: zeroinitializer
+  return _mm512_setzero_si512();
+}
+
+__m512i test_mm512_setzero_ps()
+{
+  // CHECK-LABEL: @test_mm512_setzero_ps
+  // CHECK: zeroinitializer
+  return _mm512_setzero_ps();
+}
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -164,6 +164,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -268,6 +270,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {


Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -7266,3 +7266,31 @@
 return _mm512_setr_ps( __A, __B, __C, __D, __E, __F, __G, __H,
   __I, __J, __K, __L, __M, __N, __O, __P);
 }
+
+__m512i test_mm512_setzero_epi32()
+{
+  // CHECK-LABEL: @test_mm512_setzero_epi32
+  // CHECK: zeroinitializer
+  return _mm512_setzero_epi32();
+}
+
+__m512i test_mm512_setzero()
+{
+  // CHECK-LABEL: @test_mm512_setzero
+  // CHECK: zeroinitializer
+  return _mm512_setzero();
+}
+
+__m512i test_mm512_setzero_si512()
+{
+  // CHECK-LABEL: @test_mm512_setzero_si512
+  // CHECK: zeroinitializer
+  return _mm512_setzero_si512();
+}
+
+__m512i test_mm512_setzero_ps()
+{
+  // CHECK-LABEL: @test_mm512_setzero_ps
+  // CHECK: zeroinitializer
+  return _mm512_setzero_ps();
+}
Index: lib/Headers/avx512fintrin.h
===
--- lib/Headers/avx512fintrin.h
+++ lib/Headers/avx512fintrin.h
@@ -164,6 +164,8 @@
   return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
 }
 
+#define _mm512_setzero_epi32 _mm512_setzero_si512
+
 static __inline__ __m512d __DEFAULT_FN_ATTRS
 _mm512_undefined_pd()
 {
@@ -268,6 +270,9 @@
   return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 }
+
+#define _mm512_setzero _mm512_setzero_ps
+
 static  __inline __m512d __DEFAULT_FN_ATTRS
 _mm512_setzero_pd(void)
 {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits