Home | History | Annotate | Download | only in AMDGPU
      1 // RUN: not llvm-mc -arch=amdgcn -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SI  %s
      2 // RUN: not llvm-mc -arch=amdgcn -mcpu=SI -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=SI %s
      3 // RUN: llvm-mc -arch=amdgcn -mcpu=bonaire -show-encoding %s | FileCheck --check-prefix=GCN --check-prefix=CI %s
      4 // RUN: not llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck --check-prefix=VI %s
      5 
      6 // RUN: not llvm-mc -arch=amdgcn %s 2>&1 | FileCheck %s --check-prefix=NOSI
      7 // RUN: not llvm-mc -arch=amdgcn -mcpu=SI  %s 2>&1 | FileCheck %s --check-prefix=NOSI
      8 // RUN: not llvm-mc -arch=amdgcn -mcpu=fiji  %s 2>&1 | FileCheck %s --check-prefix=NOVI
      9 
     10 //===----------------------------------------------------------------------===//
     11 // Offset Handling
     12 //===----------------------------------------------------------------------===//
     13 
     14 s_load_dword s1, s[2:3], 0xfc
     15 // GCN: s_load_dword s1, s[2:3], 0xfc ; encoding: [0xfc,0x83,0x00,0xc0]
     16 // VI:	s_load_dword s1, s[2:3], 0xfc   ; encoding: [0x41,0x00,0x02,0xc0,0xfc,0x00,0x00,0x00]
     17 
     18 s_load_dword s1, s[2:3], 0xff
     19 // GCN: s_load_dword s1, s[2:3], 0xff ; encoding: [0xff,0x83,0x00,0xc0]
     20 // VI:	s_load_dword s1, s[2:3], 0xff   ; encoding: [0x41,0x00,0x02,0xc0,0xff,0x00,0x00,0x00]
     21 
     22 s_load_dword s1, s[2:3], 0x100
     23 // NOSI: error: instruction not supported on this GPU
     24 // NOVI: error: instruction not supported on this GPU
     25 // CI: s_load_dword s1, s[2:3], 0x100 ; encoding: [0xff,0x82,0x00,0xc0,0x00,0x01,0x00,0x00]
     26 
     27 //===----------------------------------------------------------------------===//
     28 // Instructions
     29 //===----------------------------------------------------------------------===//
     30 
     31 s_load_dword s1, s[2:3], 1
     32 // GCN: s_load_dword s1, s[2:3], 0x1 ; encoding: [0x01,0x83,0x00,0xc0]
     33 // VI:	s_load_dword s1, s[2:3], 0x1    ; encoding: [0x41,0x00,0x02,0xc0,0x01,0x00,0x00,0x00]
     34 
     35 s_load_dword s1, s[2:3], s4
     36 // GCN: s_load_dword s1, s[2:3], s4 ; encoding: [0x04,0x82,0x00,0xc0]
     37 // VI:	s_load_dword s1, s[2:3], s4     ; encoding: [0x41,0x00,0x00,0xc0,0x04,0x00,0x00,0x00]
     38 
     39 s_load_dwordx2 s[2:3], s[2:3], 1
     40 // GCN: s_load_dwordx2 s[2:3], s[2:3], 0x1 ; encoding: [0x01,0x03,0x41,0xc0]
     41 // VI:	s_load_dwordx2 s[2:3], s[2:3], 0x1 ; encoding: [0x81,0x00,0x06,0xc0,0x01,0x00,0x00,0x00]
     42 
     43 s_load_dwordx2 s[2:3], s[2:3], s4
     44 // GCN: s_load_dwordx2 s[2:3], s[2:3], s4 ; encoding: [0x04,0x02,0x41,0xc0]
     45 // VI:	s_load_dwordx2 s[2:3], s[2:3], s4 ; encoding: [0x81,0x00,0x04,0xc0,0x04,0x00,0x00,0x00]
     46 
     47 s_load_dwordx4 s[4:7], s[2:3], 1
     48 // GCN: s_load_dwordx4 s[4:7], s[2:3], 0x1 ; encoding: [0x01,0x03,0x82,0xc0]
     49 // VI:	s_load_dwordx4 s[4:7], s[2:3], 0x1 ; encoding: [0x01,0x01,0x0a,0xc0,0x01,0x00,0x00,0x00]
     50 
     51 s_load_dwordx4 s[4:7], s[2:3], s4
     52 // GCN: s_load_dwordx4 s[4:7], s[2:3], s4 ; encoding: [0x04,0x02,0x82,0xc0]
     53 // VI:	s_load_dwordx4 s[4:7], s[2:3], s4 ; encoding: [0x01,0x01,0x08,0xc0,0x04,0x00,0x00,0x00]
     54 
     55 s_load_dwordx4 ttmp[4:7], ttmp[2:3], ttmp4
     56 // GCN: s_load_dwordx4 ttmp[4:7], ttmp[2:3], ttmp4 ; encoding: [0x74,0x72,0xba,0xc0]
     57 // VI:	s_load_dwordx4 ttmp[4:7], ttmp[2:3], ttmp4 ; encoding: [0x39,0x1d,0x08,0xc0,0x74,0x00,0x00,0x00]
     58 
     59 s_load_dwordx4 s[100:103], s[2:3], s4
     60 // GCN: s_load_dwordx4 s[100:103], s[2:3], s4 ; encoding: [0x04,0x02,0xb2,0xc0]
     61 // NOVI: error: not a valid operand
     62 
     63 s_load_dwordx8 s[8:15], s[2:3], 1
     64 // GCN: s_load_dwordx8 s[8:15], s[2:3], 0x1 ; encoding: [0x01,0x03,0xc4,0xc0]
     65 // VI:	s_load_dwordx8 s[8:15], s[2:3], 0x1 ; encoding: [0x01,0x02,0x0e,0xc0,0x01,0x00,0x00,0x00]
     66 
     67 s_load_dwordx8 s[8:15], s[2:3], s4
     68 // GCN: s_load_dwordx8 s[8:15], s[2:3], s4 ; encoding: [0x04,0x02,0xc4,0xc0]
     69 // VI:	s_load_dwordx8 s[8:15], s[2:3], s4 ; encoding: [0x01,0x02,0x0c,0xc0,0x04,0x00,0x00,0x00]
     70 
     71 s_load_dwordx8 s[96:103], s[2:3], s4
     72 // GCN: s_load_dwordx8 s[96:103], s[2:3], s4 ; encoding: [0x04,0x02,0xf0,0xc0]
     73 // NOVI: error: not a valid operand
     74 
     75 s_load_dwordx16 s[16:31], s[2:3], 1
     76 // GCN: s_load_dwordx16 s[16:31], s[2:3], 0x1 ; encoding: [0x01,0x03,0x08,0xc1]
     77 // VI:	s_load_dwordx16 s[16:31], s[2:3], 0x1 ; encoding: [0x01,0x04,0x12,0xc0,0x01,0x00,0x00,0x00]
     78 
     79 s_load_dwordx16 s[16:31], s[2:3], s4
     80 // GCN: s_load_dwordx16 s[16:31], s[2:3], s4 ; encoding: [0x04,0x02,0x08,0xc1]
     81 // VI:	s_load_dwordx16 s[16:31], s[2:3], s4 ; encoding: [0x01,0x04,0x10,0xc0,0x04,0x00,0x00,0x00]
     82 
     83 s_load_dwordx16 s[88:103], s[2:3], s4
     84 // GCN: s_load_dwordx16 s[88:103], s[2:3], s4 ; encoding: [0x04,0x02,0x2c,0xc1]
     85 // NOVI: error: not a valid operand
     86 
     87 s_buffer_load_dword s1, s[4:7], 1
     88 // GCN: s_buffer_load_dword s1, s[4:7], 0x1 ; encoding: [0x01,0x85,0x00,0xc2]
     89 // VI:	s_buffer_load_dword s1, s[4:7], 0x1    ; encoding: [0x42,0x00,0x22,0xc0,0x01,0x00,0x00,0x00]
     90 
     91 s_buffer_load_dword s1, s[4:7], s4
     92 // GCN: s_buffer_load_dword s1, s[4:7], s4 ; encoding: [0x04,0x84,0x00,0xc2]
     93 // VI:	s_buffer_load_dword s1, s[4:7], s4     ; encoding: [0x42,0x00,0x20,0xc0,0x04,0x00,0x00,0x00]
     94 
     95 s_buffer_load_dword ttmp1, ttmp[4:7], ttmp4
     96 // GCN: s_buffer_load_dword ttmp1, ttmp[4:7], ttmp4 ; encoding: [0x74,0xf4,0x38,0xc2]
     97 // VI:	s_buffer_load_dword ttmp1, ttmp[4:7], ttmp4 ; encoding: [0x7a,0x1c,0x20,0xc0,0x74,0x00,0x00,0x00]
     98 
     99 s_buffer_load_dwordx2 s[8:9], s[4:7], 1
    100 // GCN: s_buffer_load_dwordx2 s[8:9], s[4:7], 0x1 ; encoding: [0x01,0x05,0x44,0xc2]
    101 // VI:	s_buffer_load_dwordx2 s[8:9], s[4:7], 0x1 ; encoding: [0x02,0x02,0x26,0xc0,0x01,0x00,0x00,0x00]
    102 
    103 s_buffer_load_dwordx2 s[8:9], s[4:7], s4
    104 // GCN: s_buffer_load_dwordx2 s[8:9], s[4:7], s4 ; encoding: [0x04,0x04,0x44,0xc2]
    105 // VI:	s_buffer_load_dwordx2 s[8:9], s[4:7], s4 ; encoding: [0x02,0x02,0x24,0xc0,0x04,0x00,0x00,0x00]
    106 
    107 s_buffer_load_dwordx4 s[8:11], s[4:7], 1
    108 // GCN: s_buffer_load_dwordx4 s[8:11], s[4:7], 0x1 ; encoding: [0x01,0x05,0x84,0xc2]
    109 // VI:	s_buffer_load_dwordx4 s[8:11], s[4:7], 0x1 ; encoding: [0x02,0x02,0x2a,0xc0,0x01,0x00,0x00,0x00]
    110 
    111 s_buffer_load_dwordx4 s[8:11], s[4:7], s4
    112 // GCN: s_buffer_load_dwordx4 s[8:11], s[4:7], s4 ; encoding: [0x04,0x04,0x84,0xc2]
    113 // VI:	s_buffer_load_dwordx4 s[8:11], s[4:7], s4 ; encoding: [0x02,0x02,0x28,0xc0,0x04,0x00,0x00,0x00]
    114 
    115 s_buffer_load_dwordx4 ttmp[8:11], ttmp[4:7], ttmp4
    116 // GCN: s_buffer_load_dwordx4 ttmp[8:11], ttmp[4:7], ttmp4 ; encoding: [0x74,0x74,0xbc,0xc2]
    117 // VI:	s_buffer_load_dwordx4 ttmp[8:11], ttmp[4:7], ttmp4 ; encoding: [0x3a,0x1e,0x28,0xc0,0x74,0x00,0x00,0x00]
    118 
    119 s_buffer_load_dwordx4 s[100:103], s[4:7], s4
    120 // GCN: s_buffer_load_dwordx4 s[100:103], s[4:7], s4 ; encoding: [0x04,0x04,0xb2,0xc2]
    121 // NOVI: error: not a valid operand
    122 
    123 s_buffer_load_dwordx8 s[8:15], s[4:7], 1
    124 // GCN: s_buffer_load_dwordx8 s[8:15], s[4:7], 0x1 ; encoding: [0x01,0x05,0xc4,0xc2]
    125 // VI:	s_buffer_load_dwordx8 s[8:15], s[4:7], 0x1 ; encoding: [0x02,0x02,0x2e,0xc0,0x01,0x00,0x00,0x00]
    126 
    127 s_buffer_load_dwordx8 s[8:15], s[4:7], s4
    128 // GCN: s_buffer_load_dwordx8 s[8:15], s[4:7], s4 ; encoding: [0x04,0x04,0xc4,0xc2]
    129 // VI:	s_buffer_load_dwordx8 s[8:15], s[4:7], s4 ; encoding: [0x02,0x02,0x2c,0xc0,0x04,0x00,0x00,0x00]
    130 
    131 s_buffer_load_dwordx8 s[96:103], s[4:7], s4
    132 // GCN: s_buffer_load_dwordx8 s[96:103], s[4:7], s4 ; encoding: [0x04,0x04,0xf0,0xc2]
    133 // NOVI: error: not a valid operand
    134 
    135 s_buffer_load_dwordx16 s[16:31], s[4:7], 1
    136 // GCN: s_buffer_load_dwordx16 s[16:31], s[4:7], 0x1 ; encoding: [0x01,0x05,0x08,0xc3]
    137 // VI:	s_buffer_load_dwordx16 s[16:31], s[4:7], 0x1 ; encoding: [0x02,0x04,0x32,0xc0,0x01,0x00,0x00,0x00]
    138 
    139 s_buffer_load_dwordx16 s[16:31], s[4:7], s4
    140 // GCN: s_buffer_load_dwordx16 s[16:31], s[4:7], s4 ; encoding: [0x04,0x04,0x08,0xc3]
    141 // VI:	s_buffer_load_dwordx16 s[16:31], s[4:7], s4 ; encoding: [0x02,0x04,0x30,0xc0,0x04,0x00,0x00,0x00]
    142 
    143 s_buffer_load_dwordx16 s[88:103], s[4:7], s4
    144 // GCN: s_buffer_load_dwordx16 s[88:103], s[4:7], s4 ; encoding: [0x04,0x04,0x2c,0xc3]
    145 // NOVI: error: not a valid operand
    146 
    147 s_dcache_inv
    148 // GCN: s_dcache_inv ; encoding: [0x00,0x00,0xc0,0xc7]
    149 // VI:	s_dcache_inv                    ; encoding: [0x00,0x00,0x80,0xc0,0x00,0x00,0x00,0x00]
    150 
    151 s_dcache_inv_vol
    152 // CI: s_dcache_inv_vol ; encoding: [0x00,0x00,0x40,0xc7]
    153 // NOSI: error: instruction not supported on this GPU
    154 // VI: s_dcache_inv_vol                ; encoding: [0x00,0x00,0x88,0xc0,0x00,0x00,0x00,0x00]
    155 
    156 s_memtime s[4:5]
    157 // GCN: s_memtime s[4:5] ; encoding: [0x00,0x00,0x82,0xc7]
    158 // VI:	s_memtime s[4:5]                ; encoding: [0x00,0x01,0x90,0xc0,0x00,0x00,0x00,0x00]
    159