Home | History | Annotate | Download | only in AArch64
      1 // RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+neon -show-encoding < %s | FileCheck %s
      2 
      3 // Check that the assembler can handle the documented syntax for AArch64
      4 
      5 
      6 //----------------------------------------------------------------------
      7 // Vector Move Immediate Shifted
      8 //----------------------------------------------------------------------
      9          movi v0.2s, #1
     10          movi v1.2s, #0
     11          movi v15.2s, #1, lsl #8
     12          movi v16.2s, #1, lsl #16
     13          movi v31.2s, #1, lsl #24
     14          movi v0.4s, #1
     15          movi v0.4s, #1, lsl #8
     16          movi v0.4s, #1, lsl #16
     17          movi v0.4s, #1, lsl #24
     18          movi v0.4h, #1
     19          movi v0.4h, #1, lsl #8
     20          movi v0.8h, #1
     21          movi v0.8h, #1, lsl #8
     22 
     23 // CHECK:  movi v0.2s, #{{0x1|1}}           // encoding: [0x20,0x04,0x00,0x0f]
     24 // CHECK:  movi v1.2s, #{{0x0|0}}           // encoding: [0x01,0x04,0x00,0x0f]
     25 // CHECK:  movi v15.2s, #{{0x1|1}}, lsl #8  // encoding: [0x2f,0x24,0x00,0x0f]
     26 // CHECK:  movi v16.2s, #{{0x1|1}}, lsl #16 // encoding: [0x30,0x44,0x00,0x0f]
     27 // CHECK:  movi v31.2s, #{{0x1|1}}, lsl #24 // encoding: [0x3f,0x64,0x00,0x0f]
     28 // CHECK:  movi v0.4s, #{{0x1|1}}           // encoding: [0x20,0x04,0x00,0x4f]
     29 // CHECK:  movi v0.4s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x24,0x00,0x4f]
     30 // CHECK:  movi v0.4s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x44,0x00,0x4f]
     31 // CHECK:  movi v0.4s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x64,0x00,0x4f]
     32 // CHECK:  movi v0.4h, #{{0x1|1}}           // encoding: [0x20,0x84,0x00,0x0f]
     33 // CHECK:  movi v0.4h, #{{0x1|1}}, lsl #8   // encoding: [0x20,0xa4,0x00,0x0f]
     34 // CHECK:  movi v0.8h, #{{0x1|1}}           // encoding: [0x20,0x84,0x00,0x4f]
     35 // CHECK:  movi v0.8h, #{{0x1|1}}, lsl #8   // encoding: [0x20,0xa4,0x00,0x4f]
     36 
     37 //----------------------------------------------------------------------
     38 // Vector Move Inverted Immediate Shifted
     39 //----------------------------------------------------------------------
     40          mvni v0.2s, #1
     41          mvni v1.2s, #0
     42          mvni v0.2s, #1, lsl #8
     43          mvni v0.2s, #1, lsl #16
     44          mvni v0.2s, #1, lsl #24
     45          mvni v0.4s, #1
     46          mvni v15.4s, #1, lsl #8
     47          mvni v16.4s, #1, lsl #16
     48          mvni v31.4s, #1, lsl #24
     49          mvni v0.4h, #1
     50          mvni v0.4h, #1, lsl #8
     51          mvni v0.8h, #1
     52          mvni v0.8h, #1, lsl #8
     53 
     54 // CHECK:  mvni v0.2s, #{{0x1|1}}           // encoding: [0x20,0x04,0x00,0x2f]
     55 // CHECK:  mvni v1.2s, #{{0x0|0}}           // encoding: [0x01,0x04,0x00,0x2f]
     56 // CHECK:  mvni v0.2s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x24,0x00,0x2f]
     57 // CHECK:  mvni v0.2s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x44,0x00,0x2f]
     58 // CHECK:  mvni v0.2s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x64,0x00,0x2f]
     59 // CHECK:  mvni v0.4s, #{{0x1|1}}           // encoding: [0x20,0x04,0x00,0x6f]
     60 // CHECK:  mvni v15.4s, #{{0x1|1}}, lsl #8  // encoding: [0x2f,0x24,0x00,0x6f]
     61 // CHECK:  mvni v16.4s, #{{0x1|1}}, lsl #16 // encoding: [0x30,0x44,0x00,0x6f]
     62 // CHECK:  mvni v31.4s, #{{0x1|1}}, lsl #24 // encoding: [0x3f,0x64,0x00,0x6f]
     63 // CHECK:  mvni v0.4h, #{{0x1|1}}           // encoding: [0x20,0x84,0x00,0x2f]
     64 // CHECK:  mvni v0.4h, #{{0x1|1}}, lsl #8   // encoding: [0x20,0xa4,0x00,0x2f]
     65 // CHECK:  mvni v0.8h, #{{0x1|1}}           // encoding: [0x20,0x84,0x00,0x6f]
     66 // CHECK:  mvni v0.8h, #{{0x1|1}}, lsl #8   // encoding: [0x20,0xa4,0x00,0x6f]
     67 
     68 //----------------------------------------------------------------------
     69 // Vector Bitwise Bit Clear (AND NOT) - immediate
     70 //----------------------------------------------------------------------
     71          bic v0.2s, #1
     72          bic v1.2s, #0
     73          bic v0.2s, #1, lsl #8
     74          bic v0.2s, #1, lsl #16
     75          bic v0.2s, #1, lsl #24
     76          bic v0.4s, #1
     77          bic v0.4s, #1, lsl #8
     78          bic v0.4s, #1, lsl #16
     79          bic v0.4s, #1, lsl #24
     80          bic v15.4h, #1
     81          bic v16.4h, #1, lsl #8
     82          bic v0.8h, #1
     83          bic v31.8h, #1, lsl #8
     84 
     85 // CHECK:  bic v0.2s, #{{0x1|1}}           // encoding: [0x20,0x14,0x00,0x2f]
     86 // CHECK:  bic v1.2s, #{{0x0|0}}           // encoding: [0x01,0x14,0x00,0x2f]
     87 // CHECK:  bic v0.2s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x34,0x00,0x2f]
     88 // CHECK:  bic v0.2s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x54,0x00,0x2f]
     89 // CHECK:  bic v0.2s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x74,0x00,0x2f]
     90 // CHECK:  bic v0.4s, #{{0x1|1}}           // encoding: [0x20,0x14,0x00,0x6f]
     91 // CHECK:  bic v0.4s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x34,0x00,0x6f]
     92 // CHECK:  bic v0.4s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x54,0x00,0x6f]
     93 // CHECK:  bic v0.4s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x74,0x00,0x6f]
     94 // CHECK:  bic v15.4h, #{{0x1|1}}          // encoding: [0x2f,0x94,0x00,0x2f]
     95 // CHECK:  bic v16.4h, #{{0x1|1}}, lsl #8  // encoding: [0x30,0xb4,0x00,0x2f]
     96 // CHECK:  bic v0.8h, #{{0x1|1}}           // encoding: [0x20,0x94,0x00,0x6f]
     97 // CHECK:  bic v31.8h, #{{0x1|1}}, lsl #8  // encoding: [0x3f,0xb4,0x00,0x6f]
     98 
     99 //----------------------------------------------------------------------
    100 // Vector Bitwise OR - immedidate
    101 //----------------------------------------------------------------------
    102          orr v0.2s, #1
    103          orr v1.2s, #0
    104          orr v0.2s, #1, lsl #8
    105          orr v0.2s, #1, lsl #16
    106          orr v0.2s, #1, lsl #24
    107          orr v0.4s, #1
    108          orr v0.4s, #1, lsl #8
    109          orr v0.4s, #1, lsl #16
    110          orr v0.4s, #1, lsl #24
    111          orr v31.4h, #1
    112          orr v15.4h, #1, lsl #8
    113          orr v0.8h, #1
    114          orr v16.8h, #1, lsl #8
    115 
    116 // CHECK:  orr v0.2s, #{{0x1|1}}           // encoding: [0x20,0x14,0x00,0x0f]
    117 // CHECK:  orr v1.2s, #{{0x0|0}}           // encoding: [0x01,0x14,0x00,0x0f]
    118 // CHECK:  orr v0.2s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x34,0x00,0x0f]
    119 // CHECK:  orr v0.2s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x54,0x00,0x0f]
    120 // CHECK:  orr v0.2s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x74,0x00,0x0f]
    121 // CHECK:  orr v0.4s, #{{0x1|1}}           // encoding: [0x20,0x14,0x00,0x4f]
    122 // CHECK:  orr v0.4s, #{{0x1|1}}, lsl #8   // encoding: [0x20,0x34,0x00,0x4f]
    123 // CHECK:  orr v0.4s, #{{0x1|1}}, lsl #16  // encoding: [0x20,0x54,0x00,0x4f]
    124 // CHECK:  orr v0.4s, #{{0x1|1}}, lsl #24  // encoding: [0x20,0x74,0x00,0x4f]
    125 // CHECK:  orr v31.4h, #{{0x1|1}}          // encoding: [0x3f,0x94,0x00,0x0f]
    126 // CHECK:  orr v15.4h, #{{0x1|1}}, lsl #8  // encoding: [0x2f,0xb4,0x00,0x0f]
    127 // CHECK:  orr v0.8h, #{{0x1|1}}           // encoding: [0x20,0x94,0x00,0x4f]
    128 // CHECK:  orr v16.8h, #{{0x1|1}}, lsl #8  // encoding: [0x30,0xb4,0x00,0x4f]
    129 
    130 //----------------------------------------------------------------------
    131 // Vector Move Immediate Masked
    132 //----------------------------------------------------------------------
    133          movi v0.2s, #1, msl #8
    134          movi v1.2s, #1, msl #16
    135          movi v0.4s, #1, msl #8
    136          movi v31.4s, #1, msl #16
    137 
    138 // CHECK:  movi v0.2s, #{{0x1|1}}, msl #8   // encoding: [0x20,0xc4,0x00,0x0f]
    139 // CHECK:  movi v1.2s, #{{0x1|1}}, msl #16  // encoding: [0x21,0xd4,0x00,0x0f]
    140 // CHECK:  movi v0.4s, #{{0x1|1}}, msl #8   // encoding: [0x20,0xc4,0x00,0x4f]
    141 // CHECK:  movi v31.4s, #{{0x1|1}}, msl #16 // encoding: [0x3f,0xd4,0x00,0x4f]
    142 
    143 //----------------------------------------------------------------------
    144 // Vector Move Inverted Immediate Masked
    145 //----------------------------------------------------------------------
    146          mvni v1.2s, #0x1, msl #8
    147          mvni v0.2s, #0x1, msl #16
    148          mvni v31.4s, #0x1, msl #8
    149          mvni v0.4s, #0x1, msl #16
    150 
    151 // CHECK:   mvni v1.2s, #{{0x1|1}}, msl #8  // encoding: [0x21,0xc4,0x00,0x2f]
    152 // CHECK:   mvni v0.2s, #{{0x1|1}}, msl #16 // encoding: [0x20,0xd4,0x00,0x2f]
    153 // CHECK:   mvni v31.4s, #{{0x1|1}}, msl #8 // encoding: [0x3f,0xc4,0x00,0x6f]
    154 // CHECK:   mvni v0.4s, #{{0x1|1}}, msl #16 // encoding: [0x20,0xd4,0x00,0x6f]
    155 
    156 //----------------------------------------------------------------------
    157 // Vector Immediate - per byte
    158 //----------------------------------------------------------------------
    159          movi v0.8b, #0
    160          movi v31.8b, #0xff
    161          movi v15.16b, #0xf
    162          movi v31.16b, #0x1f
    163 
    164 // CHECK:   movi v0.8b, #{{0x0|0}}        // encoding: [0x00,0xe4,0x00,0x0f]
    165 // CHECK:   movi v31.8b, #{{0xff|255}}      // encoding: [0xff,0xe7,0x07,0x0f]
    166 // CHECK:   movi v15.16b, #{{0xf|15}}      // encoding: [0xef,0xe5,0x00,0x4f]
    167 // CHECK:   movi v31.16b, #{{0x1f|31}}     // encoding: [0xff,0xe7,0x00,0x4f]
    168 
    169 //----------------------------------------------------------------------
    170 // Vector Move Immediate - bytemask, per doubleword
    171 //---------------------------------------------------------------------
    172          movi v0.2d, #0xff00ff00ff00ff00
    173 
    174 // CHECK: movi v0.2d, #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x6f]
    175 
    176 //----------------------------------------------------------------------
    177 // Vector Move Immediate - bytemask, one doubleword
    178 //----------------------------------------------------------------------
    179          movi d0, #0xff00ff00ff00ff00
    180 
    181 // CHECK: movi d0,  #0xff00ff00ff00ff00 // encoding: [0x40,0xe5,0x05,0x2f]
    182 
    183 //----------------------------------------------------------------------
    184 // Vector Floating Point Move Immediate
    185 //----------------------------------------------------------------------
    186          fmov v1.2s, #1.0
    187          fmov v15.4s, #1.0
    188          fmov v31.2d, #1.0
    189 
    190 // CHECK:  fmov v1.2s, #{{1.00000000|1.000000e\+00}}     // encoding: [0x01,0xf6,0x03,0x0f]
    191 // CHECK:  fmov v15.4s, #{{1.00000000|1.000000e\+00}}    // encoding: [0x0f,0xf6,0x03,0x4f]
    192 // CHECK:  fmov v31.2d, #{{1.00000000|1.000000e\+00}}    // encoding: [0x1f,0xf6,0x03,0x6f]
    193 
    194 
    195 //----------------------------------------------------------------------
    196 // Vector Move -  register
    197 //----------------------------------------------------------------------
    198 
    199       mov v0.8b, v31.8b
    200       mov v15.16b, v16.16b
    201       orr v0.8b, v31.8b, v31.8b
    202       orr v15.16b, v16.16b, v16.16b
    203 
    204 // CHECK:   mov v0.8b, v31.8b      // encoding: [0xe0,0x1f,0xbf,0x0e]
    205 // CHECK:   mov v15.16b, v16.16b  // encoding: [0x0f,0x1e,0xb0,0x4e]
    206 // CHECK:   mov v0.8b, v31.8b      // encoding: [0xe0,0x1f,0xbf,0x0e]
    207 // CHECK:   mov v15.16b, v16.16b  // encoding: [0x0f,0x1e,0xb0,0x4e]
    208 
    209