Addition of tests to previous check-in. Tests for coprocessor register usage in Sparc.
authorChris Dewhurst <chris.dewhurst@lero.ie>
Sat, 27 Feb 2016 12:52:26 +0000 (12:52 +0000)
committerChris Dewhurst <chris.dewhurst@lero.ie>
Sat, 27 Feb 2016 12:52:26 +0000 (12:52 +0000)
Previous check-in message was:

The patch adds missing registers and instructions to complete all the registers supported by the Sparc v8 manual.
These are all co-processor registers, with the exception of the floating-point deferred-trap queue register.
Although these will not be lowered automatically by any instructions, it allows the use of co-processor
instructions implemented by inline-assembly.

Code Reviewed at http://reviews.llvm.org/D17133, with the exception of a very small change in brace placement in SparcInstrInfo.td,
which was formerly causing a problem in the disassembly of the %fq register.

llvm-svn: 262135

llvm/test/MC/Sparc/sparc-coproc.s [new file with mode: 0644]

diff --git a/llvm/test/MC/Sparc/sparc-coproc.s b/llvm/test/MC/Sparc/sparc-coproc.s
new file mode 100644 (file)
index 0000000..f83e415
--- /dev/null
@@ -0,0 +1,72 @@
+! RUN: llvm-mc %s -arch=sparc -show-encoding | FileCheck %s
+
+        ! CHECK: ld [%i1], %c4        ! encoding: [0xc9,0x86,0x40,0x00]
+        ! CHECK: ld [%i1+-15], %c4    ! encoding: [0xc9,0x86,0x7f,0xf1]
+        ! CHECK: ld [%i1+%o3], %c4    ! encoding: [0xc9,0x86,0x40,0x0b]
+        ! CHECK: ld [%i7], %c4        ! encoding: [0xc9,0x87,0xc0,0x00]
+        ! CHECK: ld [%i1], %c19       ! encoding: [0xe7,0x86,0x40,0x00]
+        ld [%i1], %c4
+        ld [%i1 - 15], %c4
+        ld [%i1 +%o3], %c4
+        ld [%i7], %c4
+        ld [%i1], %c19
+
+
+        ! CHECK: ldd [%i1], %c4       ! encoding: [0xc9,0x9e,0x40,0x00]
+        ! CHECK: ldd [%i7], %c4       ! encoding: [0xc9,0x9f,0xc0,0x00]
+        ! CHECK: ldd [%i7+200], %c4   ! encoding: [0xc9,0x9f,0xe0,0xc8]
+        ! CHECK: ldd [%i7+%o3], %c4   ! encoding: [0xc9,0x9f,0xc0,0x0b]
+        ! CHECK: ldd [%i1], %c30      ! encoding: [0xfd,0x9e,0x40,0x00]
+        ldd [%i1], %c4
+        ldd [%i7], %c4
+        ldd [%i7 + 200], %c4
+        ldd [%i7+%o3], %c4
+        ldd [%i1], %c30
+
+
+        ! CHECK: st %c4, [%i1]        ! encoding: [0xc9,0xa6,0x40,0x00]
+        ! CHECK: st %c4, [%i7]        ! encoding: [0xc9,0xa7,0xc0,0x00]
+        ! CHECK: st %c4, [%i7+48]     ! encoding: [0xc9,0xa7,0xe0,0x30]
+        ! CHECK: st %c4, [%i4+%o2]    ! encoding: [0xc9,0xa7,0x00,0x0a]
+        ! CHECK: st %c19, [%i1]       ! encoding: [0xe7,0xa6,0x40,0x00]
+        st %c4, [%i1]
+        st %c4, [%i7]
+        st %c4, [%i7+48]
+        st %c4, [%i4+%o2]
+        st %c19, [%i1]
+
+
+        ! CHECK: std %c4, [%i1]       ! encoding: [0xc9,0xbe,0x40,0x00]
+        ! CHECK: std %c4, [%i7]       ! encoding: [0xc9,0xbf,0xc0,0x00]
+        ! CHECK: std %c4, [%i2+-240]  ! encoding: [0xc9,0xbe,0xbf,0x10]
+        ! CHECK: std %c4, [%i1+%o5]   ! encoding: [0xc9,0xbe,0x40,0x0d]
+        ! CHECK: std %c30, [%i1]      ! encoding: [0xfd,0xbe,0x40,0x00]
+        std %c4, [%i1]
+        std %c4, [%i7]
+        std %c4, [%i2-240]
+        std %c4, [%i1+%o5]
+        std %c30, [%i1]
+
+
+        ! CHECK: ld [%i5], %csr       ! encoding: [0xc1,0x8f,0x40,0x00]
+        ! CHECK: ld [%l2+3], %csr     ! encoding: [0xc1,0x8c,0xa0,0x03]
+        ! CHECK: ld [%l4+%l5], %csr   ! encoding: [0xc1,0x8d,0x00,0x15]
+        ld [%i5], %csr
+        ld [%l2+3], %csr
+        ld [%l4+%l5], %csr
+
+
+        ! CHECK: st %csr, [%i2]       ! encoding: [0xc1,0xae,0x80,0x00]
+        ! CHECK: st %csr, [%i2+31]    ! encoding: [0xc1,0xae,0xa0,0x1f]
+        ! CHECK: st %csr, [%i2+%o2]   ! encoding: [0xc1,0xae,0x80,0x0a]
+        st %csr, [%i2]
+        st %csr, [%i2+31]
+        st %csr, [%i2+%o2]
+
+        ! CHECK: std %cq, [%o3]       ! encoding: [0xc1,0xb2,0xc0,0x00]
+        ! CHECK: std %cq, [%o3+-93]   ! encoding: [0xc1,0xb2,0xff,0xa3]
+        ! CHECK: std %cq, [%o3+%l5]   ! encoding: [0xc1,0xb2,0xc0,0x15]
+        std %cq, [%o3]
+        std %cq, [%o3-93]
+        std %cq, [%o3+%l5]
+        
\ No newline at end of file