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