@@ -542,107 +542,20 @@ fn xmm_reg_index(reg: InlineAsmReg) -> Option<u32> {
542542
543543/// If the register is an AArch64 integer register then return its index.
544544fn a64_reg_index ( reg : InlineAsmReg ) -> Option < u32 > {
545- // Unlike `a64_vreg_index`, we can't subtract `x0` to get the u32 because
546- // `x19` and `x29` are missing and the integer constants for the
547- // `x0`..`x30` enum variants don't all match the register number. E.g. the
548- // integer constant for `x18` is 18, but the constant for `x20` is 19.
549- Some ( match reg {
550- InlineAsmReg :: AArch64 ( r) => {
551- use AArch64InlineAsmReg :: * ;
552- match r {
553- x0 => 0 ,
554- x1 => 1 ,
555- x2 => 2 ,
556- x3 => 3 ,
557- x4 => 4 ,
558- x5 => 5 ,
559- x6 => 6 ,
560- x7 => 7 ,
561- x8 => 8 ,
562- x9 => 9 ,
563- x10 => 10 ,
564- x11 => 11 ,
565- x12 => 12 ,
566- x13 => 13 ,
567- x14 => 14 ,
568- x15 => 15 ,
569- x16 => 16 ,
570- x17 => 17 ,
571- x18 => 18 ,
572- // x19 is reserved
573- x20 => 20 ,
574- x21 => 21 ,
575- x22 => 22 ,
576- x23 => 23 ,
577- x24 => 24 ,
578- x25 => 25 ,
579- x26 => 26 ,
580- x27 => 27 ,
581- x28 => 28 ,
582- // x29 is reserved
583- x30 => 30 ,
584- _ => return None ,
585- }
586- }
587- InlineAsmReg :: Arm64EC ( r) => {
588- use Arm64ECInlineAsmReg :: * ;
589- match r {
590- x0 => 0 ,
591- x1 => 1 ,
592- x2 => 2 ,
593- x3 => 3 ,
594- x4 => 4 ,
595- x5 => 5 ,
596- x6 => 6 ,
597- x7 => 7 ,
598- x8 => 8 ,
599- x9 => 9 ,
600- x10 => 10 ,
601- x11 => 11 ,
602- x12 => 12 ,
603- // x13 is reserved
604- // x14 is reserved
605- x15 => 15 ,
606- x16 => 16 ,
607- x17 => 17 ,
608- // x18 is reserved
609- // x19 is reserved
610- x20 => 20 ,
611- x21 => 21 ,
612- x22 => 22 ,
613- // x23 is reserved
614- // x24 is reserved
615- x25 => 25 ,
616- x26 => 26 ,
617- x27 => 27 ,
618- // x28 is reserved
619- // x29 is reserved
620- x30 => 30 ,
621- _ => return None ,
622- }
623- }
624- _ => return None ,
625- } )
545+ match reg {
546+ InlineAsmReg :: AArch64 ( r) => r. reg_index ( ) ,
547+ InlineAsmReg :: Arm64EC ( r) => r. reg_index ( ) ,
548+ _ => None ,
549+ }
626550}
627551
628552/// If the register is an AArch64 vector register then return its index.
629553fn a64_vreg_index ( reg : InlineAsmReg ) -> Option < u32 > {
630554 match reg {
631- InlineAsmReg :: AArch64 ( reg) => {
632- use AArch64InlineAsmReg :: * ;
633- if reg as u32 >= v0 as u32 && reg as u32 <= v31 as u32 {
634- return Some ( reg as u32 - v0 as u32 ) ;
635- }
636- }
637- InlineAsmReg :: Arm64EC ( reg) => {
638- use Arm64ECInlineAsmReg :: * ;
639- if reg as u32 >= v0 as u32 && reg as u32 <= v15 as u32 {
640- return Some ( reg as u32 - v0 as u32 ) ;
641- }
642- }
643- _ => { }
555+ InlineAsmReg :: AArch64 ( reg) => reg. vreg_index ( ) ,
556+ InlineAsmReg :: Arm64EC ( reg) => reg. vreg_index ( ) ,
557+ _ => None ,
644558 }
645- None
646559}
647560
648561/// Converts a register class to an LLVM constraint code.
0 commit comments