summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/asm.c
Commit message (Collapse)AuthorAgeFilesLines
* Re-check in clang support gun asm goto after fixing tests.Jennifer Yu2019-06-031-0/+21
| | | | llvm-svn: 362410
* Revert "clang support gnu asm goto."Erich Keane2019-05-301-21/+0
| | | | | | | | | | | This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
* clang support gnu asm goto.Jennifer Yu2019-05-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax: asm [volatile] goto ( AssemblerTemplate : : InputOperands : Clobbers : GotoLabels) https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html New llvm IR is "callbr" for inline asm goto instead "call" for inline asm For: asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); IR: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1 to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3 asm.fallthrough: Compiler need to generate: 1> a dummy constarint 'X' for each label. 2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number". Diagnostic 1> duplicate asm operand name are used in output, input and label. 2> goto out of scope. llvm-svn: 362045
* [OPENMP][CUDA]Do not emit warnings for variables in late-reported asmAlexey Bataev2019-02-261-1/+1
| | | | | | | | | | | | statements. If the assembler instruction is not generated and the delayed diagnostic is emitted, we may end up with extra warning message for variables used in the asm statement. Since the asm statement is not built, the variables may be left non-referenced and it may produce a warning about a use of the non-initialized variables. llvm-svn: 354928
* [inline asm][gcc-compatiblity] "=i" output constraint supportMarina Yatsina2017-06-261-0/+35
| | | | | | | | Ignore ‘i’,’n’,’E’,’F’ as output constraints in inline assembly (gcc compatibility) Differential Revision: https://reviews.llvm.org/D31383 llvm-svn: 306297
* [inline-asm]No error for conflict between inputs\outputs and clobber listMarina Yatsina2016-12-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict. for example: const long double a = 0.0; int main() { char b; double t1 = a; __asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)"); return 0; } This should conflict with the output - t1 which is st, and st which is st aswell. The patch fixes it. Commit on behald of Ziv Izhar. Differential Revision: https://reviews.llvm.org/D15075 llvm-svn: 290539
* -inline-asm][X86] Add ability to use AVX512 in MS inline asmMarina Yatsina2016-02-031-1/+1
| | | | | | | | | Defined the new AVX512 registers in clang inline asm. Fixed a bug in the MC subtarget info creation during the parsing of MS asm statement - now it receives the actual CPU and target features information. Differential Revision: http://reviews.llvm.org/D16757 llvm-svn: 259639
* Produce a better diagnostic for global register variables.Akira Hatanaka2015-11-181-5/+7
| | | | | | | | | | | | | | | | | | Currently, when there is a global register variable in a program that is bound to an invalid register, clang/llvm prints an error message that is not very user-friendly. This commit improves the diagnostic and moves the check that used to be in the backend to Sema. In addition, it makes changes to error out if the size of the register doesn't match the declared variable size. e.g., volatile register int B asm ("rbp"); rdar://problem/23084219 Differential Revision: http://reviews.llvm.org/D13834 llvm-svn: 253405
* Fix assertion in inline assembler IR genAlexander Musman2015-09-211-0/+12
| | | | | | | Several inputs may not refer to one output constraint in inline assembler insertions, clang was failing on assertion on such test case. llvm-svn: 248158
* Additional fix for PR14269: Crash on vector elements / global register vars ↵Andrey Bokhanko2015-08-031-3/+18
| | | | | | | | | | in inline assembler. Compiler crashed when vector elements / global register vars were used in inline assembler with "m" restriction. This patch fixes this. Differential Revision: http://reviews.llvm.org/D10476 llvm-svn: 243870
* Fix for PR14269: Clang crashes when a bit field is used as inline assemblerAlexander Musman2015-06-051-0/+17
| | | | | | | | | | | | input / output with memory constraint. One generally can't get address of a bit field, so the general solution is to error on such cases. GCC does the same. Patch by Andrey Bokhanko Differential Revision: http://reviews.llvm.org/D10086 llvm-svn: 239153
* Sema: Relax parsing of '#' in constraintsDavid Majnemer2015-01-141-1/+1
| | | | llvm-svn: 225942
* Basic: Numeric constraints are multidigitDavid Majnemer2015-01-111-0/+7
| | | | | | | Clang would treat the digits in an "11m" input constraint separately as if it was handling constraint 1 twice instead of constraint 11. llvm-svn: 225606
* Basic: [asmSymbolicName] follows the same rule as numbers in asm inputsDavid Majnemer2015-01-111-0/+7
| | | | | | | | | Input constraints like "0" and "[foo]" should be treated the same when it comes to their corresponding output constraint. This fixes PR21850. llvm-svn: 225605
* Basic: The asm constraint '#m' isn't valid, reject itDavid Majnemer2015-01-111-0/+7
| | | | llvm-svn: 225603
* Basic: The asm constraint '+#r' isn't valid, reject itDavid Majnemer2015-01-111-0/+6
| | | | llvm-svn: 225600
* Sema: The asm constraint '+&m' isn't valid, reject itDavid Majnemer2015-01-101-0/+6
| | | | | | Don't permit '+&m' to make it to CodeGen, it's invalid. llvm-svn: 225586
* Sema: Forbid inconsistent constraint alternativesDavid Majnemer2014-12-291-0/+7
| | | | | | Verify that asm constraints have the same number of alternatives llvm-svn: 224911
* Fix assertion on asm register that are "%"Olivier Goffart2014-08-171-0/+1
| | | | | | | | | | | Name might be empty again after we removed the '%' prefix and Name[0] would assert. Found on code like register int foo asm("%" MACRO); where MACRO was supposed to be defined in a header file that was not found. llvm-svn: 215834
* [X86 inline-asm] Error out on inline-asm constraint "=f".Akira Hatanaka2014-07-181-0/+6
| | | | | | <rdar://problem/17476689> llvm-svn: 213428
* Add pointer types to global named registerRenato Golin2014-06-051-0/+10
| | | | | | | | | | This patch adds support for pointer types in global named registers variables. It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls. Also adds some early checks on types on SemaDecl to avoid the assert. Tests changed accordingly. (PR19837) llvm-svn: 210274
* Non-allocatable Global Named RegisterRenato Golin2014-05-191-2/+0
| | | | | | | | | | | | | This patch implements global named registers in Clang, lowering to the just created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue had to be created (Register), which just adds support to carry the metadata node containing the name of the register. Two new methods to emit loads and stores interoperate with another to emit the named metadata node. No guarantees are being made and only non-allocatable global variable named registers are being supported. Local named register support is unchanged. llvm-svn: 209149
* Stop crashing on empty asm input constraintsDuncan P. N. Exon Smith2013-12-161-0/+3
| | | | | | | | | | An empty string for an ASM input constraint is invalid, and will crash during clang CodeGen. Change TargetInfo::validateInputConstraint to reject an empty string. <rdar://problem/15552191> llvm-svn: 197362
* Reject asm output constraints that consist of modifiers only.Benjamin Kramer2013-04-181-0/+16
| | | | | | Fixes PR15759. llvm-svn: 179756
* Simplify test to use a count for the number of notes expected.Bill Wendling2013-03-271-1/+1
| | | | llvm-svn: 178196
* Add another expected note. Two errors => two notes.Tim Northover2013-03-271-1/+1
| | | | llvm-svn: 178143
* Fix testcase to add expected note.Bill Wendling2013-03-271-1/+1
| | | | llvm-svn: 178122
* Emit an error message instead of crashing when dereferencing an incomplete ↵Bill Wendling2013-03-251-0/+7
| | | | | | | | | | pointer type. If the ASM statement is dereferencing an incomplete pointer type, issue an error instead of crashing. <rdar://problem/12700799> llvm-svn: 177915
* c: privide deprecated warning when __private_extern__ storageFariborz Jahanian2012-08-171-1/+1
| | | | | | | | specifier is unsed in a declaration; as it may not make the symbol local to linkage unit as intended. Suggest using "hidden" visibility attribute instead. // rdar://7703982 llvm-svn: 162138
* Add support for AVX registers to clang inline asm. Add a small testcaseEric Christopher2011-12-021-1/+1
| | | | | | | | | and update the Sema testcase with a register that we won't hit for a while I hope. Fixes rdar://10510405 llvm-svn: 145671
* Add a testcase for the previous commit and update an existing test for anEric Christopher2011-07-071-5/+5
| | | | | | | | extra register. Part of PR10299 and rdar://9740322 llvm-svn: 134657
* Fix off-by-one error in StringLiteral::getLocationOfByte.Hans Wennborg2011-06-301-0/+6
| | | | | | This fixes PR10223. llvm-svn: 134183
* Split out logic for valid clobbers and valid inline asm registers.Eric Christopher2011-06-281-0/+4
| | | | | | Fixes rdar://9281377 llvm-svn: 134016
* Use a heralded conversion to bool in inline-asm constraints.John McCall2011-05-101-0/+8
| | | | llvm-svn: 131170
* Added warning about invalid register specification for local variables.Abramo Bagnara2011-01-111-1/+11
| | | | llvm-svn: 123236
* Produce a better error message for invalid register names.Rafael Espindola2011-01-011-0/+4
| | | | llvm-svn: 122670
* When setting a tied check if it's already tied. If it's tied to another ↵Anders Carlsson2010-11-031-2/+8
| | | | | | constraint it's invalid. Fixes PR3905. llvm-svn: 118146
* A number in an input constraint can't point to a read-write ('+') ↵Anders Carlsson2010-11-031-0/+6
| | | | | | constraint. Fixes PR3904. llvm-svn: 118145
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Warn on top-level 'asm volatile' (instead of misparsing it).John McCall2010-01-251-0/+3
| | | | | | "Fixes" rdar://problem/7574870 llvm-svn: 94458
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Remove the -arch option from clang-cc: for all practical purposes, it's Eli Friedman2009-05-191-1/+1
| | | | | | redundant with -triple. llvm-svn: 72108
* If we have mismatched integer tied operands, but the operandChris Lattner2009-05-031-1/+1
| | | | | | | | number is not mentioned in the asm string, let it past sema. Right now these are currently rejected by the llvm code generator but this will be fixed next. llvm-svn: 70670
* implement PR4077: [Linux kernel] inscrutable error on inline asm ↵Chris Lattner2009-04-261-0/+7
| | | | | | | | | | | | | | | | | input/output constraint mismatch Before we emitted: $ clang t.c -S -m64 llvm: error: Unsupported asm: input constraint with a matching output constraint of incompatible type! Now we produce: $ clang t.c -S -m64 t.c:5:40: error: unsupported inline asm: input with type 'unsigned long' matching output with type 'int' asm volatile("foo " : "=a" (a) :"0" (b)); ~~~ ~^~ llvm-svn: 70142
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* fix PR3258 by rejecting invalid numeric operands.Chris Lattner2009-03-111-1/+5
| | | | llvm-svn: 66618
* checking for symbolic operands as well as % at end of string.Chris Lattner2009-03-111-7/+9
| | | | llvm-svn: 66614
* reject invalid escape characters in extended-asm strings with a nice diagnostic.Chris Lattner2009-03-101-4/+7
| | | | llvm-svn: 66605
* If an input constraint refers to an output constraint, it should have the ↵Anders Carlsson2009-01-271-1/+1
| | | | | | same constraint info as the output constraint. Fixes PR3417 llvm-svn: 63127
* Handle the 'e' constraint. Fixes PR3385Anders Carlsson2009-01-241-0/+6
| | | | llvm-svn: 62923
OpenPOWER on IntegriCloud