-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #133452 - taiki-e:hexagon-asm-pred, r=Amanieu
Support predicate registers (clobber-only) in Hexagon inline assembly The result of the Hexagon instructions such as comparison, store conditional, etc. is stored in predicate registers (`p[0-3]`), but currently there is no way to mark it as clobbered in `asm!`. This is also needed for `clobber_abi` (although implementing `clobber_abi` will require the addition of support for [several more register classes](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Hexagon/HexagonRegisterInfo.cpp#L71-L90). see also #93335 (comment)). Refs: - [Section 6 "Conditional Execution" in Qualcomm Hexagon V73 Programmer’s Reference Manual](https://docs.qualcomm.com/bundle/publicresource/80-N2040-53_REV_AB_Qualcomm_Hexagon_V73_Programmers_Reference_Manual.pdf#page=90) - [Register definition in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Hexagon/HexagonRegisterInfo.td#L155) cc `@androm3da` (target maintainer of hexagon-unknown-{[none-elf](https://doc.rust-lang.org/nightly/rustc/platform-support/hexagon-unknown-none-elf.html#target-maintainers),[linux-musl](https://doc.rust-lang.org/nightly/rustc/platform-support/hexagon-unknown-linux-musl.html#target-maintainers)}) r? `@Amanieu` `@rustbot` label +A-inline-assembly (Currently there is no O-hexagon label...)
- Loading branch information
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//@ revisions: hexagon | ||
//@[hexagon] compile-flags: --target hexagon-unknown-linux-musl | ||
//@[hexagon] needs-llvm-components: hexagon | ||
//@ compile-flags: -Zmerge-functions=disabled | ||
|
||
#![crate_type = "rlib"] | ||
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] | ||
#![no_core] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[rustc_builtin_macro] | ||
macro_rules! asm { | ||
() => {}; | ||
} | ||
|
||
// CHECK-LABEL: @flags_clobber | ||
// CHECK: call void asm sideeffect "", ""() | ||
#[no_mangle] | ||
pub unsafe fn flags_clobber() { | ||
asm!("", options(nostack, nomem)); | ||
} | ||
|
||
// CHECK-LABEL: @no_clobber | ||
// CHECK: call void asm sideeffect "", ""() | ||
#[no_mangle] | ||
pub unsafe fn no_clobber() { | ||
asm!("", options(nostack, nomem, preserves_flags)); | ||
} | ||
|
||
// CHECK-LABEL: @p0_clobber | ||
// CHECK: call void asm sideeffect "", "~{p0}"() | ||
#[no_mangle] | ||
pub unsafe fn p0_clobber() { | ||
asm!("", out("p0") _, options(nostack, nomem, preserves_flags)); | ||
} |