summary refs log tree commit diff
path: root/src/test/ui/asm
AgeCommit message (Collapse)AuthorLines
2022-07-15Fix sized check ICE in intrisicckMichael Goulet-0/+45
2022-06-16diagnostics: fix trailing spaceklensy-1/+1
2022-06-12Fix some test annotationsbjorn3-3/+4
These are necessary for running the rustc test suite with cg_clif
2022-05-29Use type_is_copy_modulo_regions check in intrisicckMichael Goulet-0/+12
2022-05-27Update tests on aarch64Oli Scherer-127/+183
2022-05-24Update messagesOli Scherer-4/+4
2022-05-24Make a test independent of 64/32 bitOli Scherer-14/+4
2022-05-24Add the transmute and asm checks to typeck as deferred checksOli Scherer-214/+449
2022-05-07Permit asm_const and asm_sym to reference outer generic paramsGary Guo-13/+33
2022-04-19Rollup merge of #95740 - Amanieu:kreg0, r=nagisaDylan DPC-10/+10
asm: Add a kreg0 register class on x86 which includes k0 Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19asm: Add a kreg0 register class on x86 which includes k0Amanieu d'Antras-10/+10
Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-16Update tests for sym support in global_asm!Amanieu d'Antras-57/+103
2022-04-03Rollup merge of #95553 - jam1garner:naked-function-compile-error, r=tmiaskoDylan DPC-1/+38
Don't emit non-asm contents error for naked function composed of errors ## Motivation For naked functions an error is emitted when they are composed of anything other than a single asm!() block. However, this error triggers in a couple situations in which it adds no additional information or is actively misleading. One example is if you do have an asm!() block but simply one with a syntax error: ```rust #[naked] unsafe extern "C" fn compiler_errors() { asm!(invalid_syntax) } ``` This results in two errors, one for the syntax error itself and another telling you that you need an asm block in your function: ```rust error[E0787]: naked functions must contain a single asm block --> src/main.rs:6:1 | 6 | / unsafe extern "C" fn naked_compile_error() { 7 | | asm!(blah) 8 | | } | |_^ ``` This issue also comes up when [utilizing `compile_error!()` for improving your diagnostics](https://twitter.com/steveklabnik/status/1509538243020218372), such as raising a compiler error when compiling for an unsupported target. ## Implementation The rules this PR implements are as follows: 1. If any non-erroneous non-asm statement is included, an error will still occur 2. If multiple asm statements are included, an error will still occur 3. If 0 or 1 asm statements are present, as well as any non-zero number of erroneous statements, then this error will *not* be raised as it is likely either redundant or incorrect The rule of thumb is effectively "if an error is present and its correction could change things, don't raise an error".
2022-04-01Add regression test for naked functions with invalid asm syntaxjam1garner-1/+13
2022-04-01Reword purpose description of noreturn in naked functionjam1garner-5/+5
2022-04-01Don't emit non-asm contents error for naked function composed of errorsjam1garner-1/+26
2022-03-31Add error message suggestion for missing noreturn in naked functionjam1garner-0/+25
2022-03-23Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,AmanieuDylan DPC-1/+1
Fold aarch64 feature +fp into +neon Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64: The Neon unit, which handles both floating point and SIMD instructions. Moreover, a configuration for AArch64 must include both or neither. Arm says "entirely proprietary" toolchains may omit floating point: https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point In the Programmer's Guide for Armv8-A, Arm says AArch64 can have both FP and Neon or neither in custom implementations: https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON In "Bare metal boot code for Armv8-A", enabling Neon and FP is just disabling the same trap flag: https://developer.arm.com/documentation/dai0527/a In an unlikely future where "Neon and FP" become unrelated, we can add "[+-]fp" as its own feature flag. Until then, we can simplify programming with Rust on AArch64 by folding both into "[+-]neon", which is valid as it supersets both. "[+-]neon" is retained for niche uses such as firmware, kernels, "I just hate floats", and so on. I am... pretty sure no one is relying on this. An argument could be made that, as we are not an "entirely proprietary" toolchain, we should not support AArch64 without floats at all. I think that's a bit excessive. However, I want to recognize the intent: programming for AArch64 should be simplified where possible. For x86-64, programmers regularly set up illegal feature configurations because it's hard to understand them, see https://github.com/rust-lang/rust/issues/89586. And per the above notes, plus the discussion in https://github.com/rust-lang/rust/issues/86941, there should be no real use cases for leaving these features split: the two should in fact always go together. - Fixes rust-lang/rust#95002. - Fixes rust-lang/rust#95064. - Fixes rust-lang/rust#95122.
2022-03-22Fold aarch64 feature +fp into +neonJubilee Young-1/+1
Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64: The Neon unit, which handles both floating point and SIMD instructions. Moreover, a configuration for AArch64 must include both or neither. Arm says "entirely proprietary" toolchains may omit floating point: https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point In the Programmer's Guide for Armv8-A, Arm says AArch64 can have both FP and Neon or neither in custom implementations: https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON In "Bare metal boot code for Armv8-A", enabling Neon and FP is just disabling the same trap flag: https://developer.arm.com/documentation/dai0527/a In an unlikely future where "Neon and FP" become unrelated, we can add "[+-]fp" as its own feature flag. Until then, we can simplify programming with Rust on AArch64 by folding both into "[+-]neon", which is valid as it supersets both. "[+-]neon" is retained for niche uses such as firmware, kernels, "I just hate floats", and so on.
2022-03-21Add needs-asm-support directive to tests where necessarybjorn3-68/+79
2022-03-03Cleanup feature gates.Camille GILLOT-33/+32
2022-02-21Add testsAmanieu d'Antras-0/+64
2022-02-21Take CodegenFnAttrs into account when validating asm! register operandsAmanieu d'Antras-21/+13
Checking of asm! register operands now properly takes function attributes such as #[target_feature] and #[instruction_set] into account.
2022-02-16Correctly mark the span of captured arguments in `format_args!()`Chayim Refael Friedman-16/+16
It should only include the identifier, or misspelling suggestions will be wrong.
2022-02-11Rollup merge of #93868 - Amanieu:asm_reg_conflict, r=cjgillotMatthias Krüger-0/+30
Fix incorrect register conflict detection in asm! This would previously incorrectly reject two subregisters that were distinct but part of the same larger register, for example `al` and `ah`.
2022-02-10Fix incorrect register conflict detection in asm!Amanieu d'Antras-0/+30
This would previously incorrectly reject two subregisters that were distinct but part of the same larger register, for example `al` and `ah`.
2022-01-31Update test output for `ui/asm/aarch64/parse-error.rs`Fabian Wolff-7/+7
2022-01-31Make `span_extend_to_prev_str()` more robustFabian Wolff-7/+7
2022-01-28Rollup merge of #92611 - Amanieu:asm-reference, r=m-ou-seMatthias Krüger-0/+36
Add links to the reference and rust by example for asm! docs and lints These were previously removed in #91728 due to broken links. cc ``@ehuss`` since this updates the rust-by-example submodule
2022-01-21Reject may_unwind option in naked functionsTomasz Miąsko-10/+22
2022-01-21Reject unsupported naked functionsTomasz Miąsko-165/+75
Transition unsupported naked functions future incompatibility lint into an error: * Naked functions must contain a single inline assembly block. Introduced as future incompatibility lint in 1.50 #79653. Change into an error fixes a soundness issue described in #32489. * Naked functions must not use any forms of inline attribute. Introduced as future incompatibility lint in 1.56 #87652.
2022-01-19Add links to the reference and rust by example for asm! docs and lintsAmanieu d'Antras-0/+36
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-71/+32
2021-12-12Re-bless asm tests for aarch64Amanieu d'Antras-152/+154
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-338/+351
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-12-12Remove automatic rustfix of asm! to llvm_asm!Amanieu d'Antras-58/+0
This no longer works now that asm! needs an explicit import. Also, it's been over a year since asm! landed, everyone should have transitioned by now.
2021-12-11Fix AArch64 asm ui testsAmanieu d'Antras-19/+11
2021-12-03fix inline asm test by not hardcoding symbol namescynecx-6/+18
2021-12-03add clobber_abi("C") to may_unwind inline-asm testscynecx-2/+2
2021-12-03add tests for asm's options(may_unwind)cynecx-0/+71
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-44/+44
2021-11-12fix aarch test error annotationsasquared31415-4/+4
2021-11-10add missing sym featureasquared31415-1/+1
2021-11-10Fix aarch testsasquared31415-60/+51
2021-11-10Add support for specifying multiple clobber_abi in `asm!`asquared31415-100/+258
Allow multiple clobber_abi in asm Update docs Fix aarch64 test Combine abis Emit duplicate ABI error, empty ABI list error multiple clobber_abi
2021-11-07Restrict tests that use needs-asm-support to non-experimentalAmanieu d'Antras-2/+3
architectures
2021-11-07Add features gates for experimental asm featuresAmanieu d'Antras-79/+92
2021-10-26Add a regression test for issue-89875Yuki Okushi-0/+14
2021-10-23bless the line changes in ui/asm/aarch64/srcloc.rsJosh Stone-23/+23
2021-10-22Update the minimum external LLVM to 12Josh Stone-1/+1