[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 10 00:01:57 PST 2019


nickdesaulniers added inline comments.


================
Comment at: test/CodeGen/asm.c:276
+  return 1;
+}
----------------
I don't understand why, but this particular test case I cannot compile standalone without `-emit-llvm`.
```
int t32(int cond) {
  asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop);
  return 0;
loop:
  return 1;
label_true:
  return 2;
}
```
```
$ clang -target x86_64-linux-gnu -emit-llvm -c test.c
$ clang -target x86_64-linux-gnu -c test.c 
test.c:2:12: error: expected a symbol reference
  asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop);
           ^
<inline asm>:1:26: note: instantiated into assembly here
        testl %edi, %edi; jne "";
                                ^
1 error generated.
```
The produced assembly doesn't seem to contain the jump destination.  Am I doing something wrong?


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

https://reviews.llvm.org/D56571





More information about the cfe-commits mailing list