From 98422af96fbd5af709a82b272951062742b77c14 Mon Sep 17 00:00:00 2001 From: Bradley Smith Date: Wed, 9 Apr 2014 14:43:24 +0000 Subject: [PATCH] [ARM64] UBFM/BFM is undefined on w registers when imms<5> or immr<5> is 1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205879 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM64/ARM64InstrFormats.td | 6 ++++++ test/MC/Disassembler/ARM64/basic-a64-undefined.txt | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib/Target/ARM64/ARM64InstrFormats.td b/lib/Target/ARM64/ARM64InstrFormats.td index f4ad842f242..6b807548db2 100644 --- a/lib/Target/ARM64/ARM64InstrFormats.td +++ b/lib/Target/ARM64/ARM64InstrFormats.td @@ -1640,6 +1640,9 @@ multiclass BitfieldImm opc, string asm> { def Wri : BaseBitfieldImm { let Inst{31} = 0; let Inst{22} = 0; + // imms<5> and immr<5> must be zero, else ReservedValue(). + let Inst{21} = 0; + let Inst{15} = 0; } def Xri : BaseBitfieldImm { let Inst{31} = 1; @@ -1671,6 +1674,9 @@ multiclass BitfieldImmWith2RegArgs opc, string asm> { def Wri : BaseBitfieldImmWith2RegArgs { let Inst{31} = 0; let Inst{22} = 0; + // imms<5> and immr<5> must be zero, else ReservedValue(). + let Inst{21} = 0; + let Inst{15} = 0; } def Xri : BaseBitfieldImmWith2RegArgs { let Inst{31} = 1; diff --git a/test/MC/Disassembler/ARM64/basic-a64-undefined.txt b/test/MC/Disassembler/ARM64/basic-a64-undefined.txt index 88e43468ec5..21ff82ccccf 100644 --- a/test/MC/Disassembler/ARM64/basic-a64-undefined.txt +++ b/test/MC/Disassembler/ARM64/basic-a64-undefined.txt @@ -17,5 +17,7 @@ # RUN: echo "0x00 0x00 0xc0 0xeb" | llvm-mc -triple=arm64 -disassemble 2>&1 | FileCheck %s # RUN: echo "0x00 0x80 0x80 0x6b" | llvm-mc -triple=arm64 -disassemble 2>&1 | FileCheck %s +# UBFM is undefined when s == 0 and imms<5> or immr<5> is 1. +# RUN: echo "0x00 0x80 0x00 0x53" | llvm-mc -triple=arm64 -disassemble 2>&1 | FileCheck %s # CHECK: invalid instruction encoding