ms-inline-asm.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // REQUIRES: x86-registered-target
  2. // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
  3. // Disabling gnu inline assembly should have no effect on this testcase
  4. // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm
  5. #define M __asm int 0x2c
  6. #define M2 int
  7. void t1(void) { M }
  8. void t2(void) { __asm int 0x2c }
  9. void t3(void) { __asm M2 0x2c }
  10. void t4(void) { __asm mov eax, fs:[0x10] }
  11. void t5() {
  12. __asm {
  13. int 0x2c ; } asm comments are fun! }{
  14. }
  15. __asm {}
  16. }
  17. int t6() {
  18. __asm int 3 ; } comments for single-line asm
  19. __asm {}
  20. __asm int 4
  21. return 10;
  22. }
  23. void t7() {
  24. __asm {
  25. push ebx
  26. mov ebx, 0x07
  27. pop ebx
  28. }
  29. }
  30. void t8() {
  31. __asm nop __asm nop __asm nop
  32. }
  33. void t9() {
  34. __asm nop __asm nop ; __asm nop
  35. }
  36. void t10() {
  37. __asm {
  38. mov eax, 0
  39. __asm {
  40. mov eax, 1
  41. {
  42. mov eax, 2
  43. }
  44. }
  45. }
  46. }
  47. void t11() {
  48. do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
  49. }
  50. void t12() {
  51. __asm jmp label // expected-error {{use of undeclared label 'label'}}
  52. }
  53. int t_fail() { // expected-note {{to match this}}
  54. __asm
  55. __asm { // expected-error 2 {{expected}} expected-note {{to match this}}