r203147 - Add tests for MS inline asm change r203146

Reid Kleckner rnk at google.com
Sat May 3 20:24:56 PDT 2014


The whole MS inline asm parser could stand to be cleaned up.  It's
basically designed to parse a fixed set of inputs.  If you feed it invalid
input, it gets really upset with you, which you can see in the diagnostics.
 That, and it's easy to make it assert.


2014-05-03 16:40 GMT-07:00 Nico Weber <thakis at chromium.org>:

> Zombie comment, I saw this error message today (I know it's not yours,
> but it looks like you touched it recently): This error message is a
> lot more dramatic than clang's error messages – could this be changed
> to start with a lowercase letter, and to not end in a "!"? Also, I
> think it's "look up" with a space when used as a verb.
>
> 2014-03-06 11:19 GMT-08:00 Reid Kleckner <reid at kleckner.net>:
> > Author: rnk
> > Date: Thu Mar  6 13:19:36 2014
> > New Revision: 203147
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=203147&view=rev
> > Log:
> > Add tests for MS inline asm change r203146
> >
> > Modified:
> >     cfe/trunk/test/CodeGen/ms-inline-asm.c
> >     cfe/trunk/test/Sema/ms-inline-asm.c
> >
> > Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=203147&r1=203146&r2=203147&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
> > +++ cfe/trunk/test/CodeGen/ms-inline-asm.c Thu Mar  6 13:19:36 2014
> > @@ -445,3 +445,18 @@ void cpuid() {
> >  // CHECK-LABEL: define void @cpuid
> >  // CHECK: call void asm sideeffect inteldialect "cpuid",
> "~{eax},~{ebx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"()
> >  }
> > +
> > +typedef struct {
> > +  int a;
> > +  int b;
> > +} A;
> > +
> > +void t39() {
> > +  __asm mov eax, [eax].A.b
> > +  __asm mov eax, [eax] A.b
> > +  __asm mov eax, fs:[0] A.b
> > +  // CHECK-LABEL: define void @t39
> > +  // CHECK: call void asm sideeffect inteldialect "mov eax, [eax].4",
> "~{eax},~{dirflag},~{fpsr},~{flags}"()
> > +  // CHECK: call void asm sideeffect inteldialect "mov eax, [eax] .4",
> "~{eax},~{dirflag},~{fpsr},~{flags}"()
> > +  // CHECK: call void asm sideeffect inteldialect "mov eax, fs:[$$0]
> .4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
> > +}
> >
> > Modified: cfe/trunk/test/Sema/ms-inline-asm.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ms-inline-asm.c?rev=203147&r1=203146&r2=203147&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/Sema/ms-inline-asm.c (original)
> > +++ cfe/trunk/test/Sema/ms-inline-asm.c Thu Mar  6 13:19:36 2014
> > @@ -75,3 +75,29 @@ int t2(int *arr, int i) {
> >    //__asm mov eax, [arr + i];
> >    return 0;
> >  }
> > +
> > +typedef struct {
> > +  int a;
> > +  int b;
> > +} A;
> > +
> > +void t3() {
> > +  __asm mov eax, [eax] UndeclaredId // expected-error {{unknown token
> in expression}}
> > +
> > +  // FIXME: Only emit one diagnostic here.
> > +  // expected-error at +2 {{unexpected type name 'A': expected
> expression}}
> > +  // expected-error at +1 {{unknown token in expression}}
> > +  __asm mov eax, [eax] A
> > +}
> > +
> > +void t4() {
> > +  // The dot in the "intel dot operator" is optional in MSVC.  MSVC
> also does
> > +  // global field lookup, but we don't.
> > +  __asm mov eax, [0] A.a
> > +  __asm mov eax, [0].A.a
> > +  __asm mov eax, [0].a    // expected-error {{Unable to lookup field
> reference!}}
> > +  __asm mov eax, fs:[0] A.a
> > +  __asm mov eax, fs:[0].A.a
> > +  __asm mov eax, fs:[0].a // expected-error {{Unable to lookup field
> reference!}}
> > +  __asm mov eax, fs:[0]. A.a  // expected-error {{Unexpected token
> type!}}
> > +}
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140503/f4bbc87f/attachment.html>


More information about the cfe-commits mailing list