brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.9 KiB · aa86f84 Raw
392 lines · plain
1// RUN: llvm-mc -triple=amdgcn -mcpu=tonga -show-encoding %s | FileCheck %s2 3//---------------------------------------------------------------------------//4// VOP1/VOP3 F165//---------------------------------------------------------------------------//6 7v_ceil_f16 v0, -18// CHECK: [0xc1,0x8a,0x00,0x7e]9 10v_ceil_f16 v0, -211// CHECK: [0xc2,0x8a,0x00,0x7e]12 13v_ceil_f16 v0, -1614// CHECK: [0xd0,0x8a,0x00,0x7e]15 16v_ceil_f16 v0, -0.517// CHECK: [0xf1,0x8a,0x00,0x7e]18 19v_ceil_f16 v0, -1.020// CHECK: [0xf3,0x8a,0x00,0x7e]21 22v_ceil_f16 v0, -2.023// CHECK: [0xf5,0x8a,0x00,0x7e]24 25v_ceil_f16 v0, -4.026// CHECK: [0xf7,0x8a,0x00,0x7e]27 28// Arbitrary f16 literal in hex29v_ceil_f16 v0, 0xabcd30// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]31 32// '-' is a part of hex literal (not a 'neg' modifier)33v_ceil_f16 v0, -0x543334// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]35 36v_ceil_f16 v0, abs(0xabcd)37// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]38 39v_ceil_f16 v0, neg(0xabcd)40// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0x2b,0x00,0x00]41 42v_ceil_f16 v0, neg(abs(0xabcd))43// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]44 45v_ceil_f16 v0, -abs(0xabcd)46// CHECK: [0xff,0x8a,0x00,0x7e,0xcd,0xab,0x00,0x00]47 48// 1/(2*pi) encoded as inline constant in VOP149v_ceil_f16 v0, 0x311850// CHECK: [0xf8,0x8a,0x00,0x7e]51 52// 1/(2*pi) encoded as inline constant in VOP353v_ceil_f16_e64 v0, 0x311854// CHECK: [0x00,0x00,0x85,0xd1,0xf8,0x00,0x00,0x00]55 56// neg(-1/(2*pi)) = 1/(2*pi)57v_ceil_f16 v0, neg(0xb118)58// CHECK: [0xf8,0x8a,0x00,0x7e]59 60// -1/(2*pi) cannot be encoded as inline constant in VOP161v_ceil_f16 v0, 0xb11862// CHECK: [0xff,0x8a,0x00,0x7e,0x18,0xb1,0x00,0x00]63 64// -1/(2*pi) cannot be encoded as inline constant in VOP165v_ceil_f16 v0, neg(0x3118)66// CHECK: [0xff,0x8a,0x00,0x7e,0x18,0xb1,0x00,0x00]67 68// -1/(2*pi) can be encoded as inline constant w/ modifiers in VOP369v_ceil_f16_e64 v0, neg(0x3118)70// CHECK: [0x00,0x00,0x85,0xd1,0xf8,0x00,0x00,0x20]71 72v_ceil_f16_e64 v0, abs(0x3118)73// CHECK: 0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x00]74 75v_ceil_f16_e64 v0, neg(abs(0x3118))76// CHECK: [0x00,0x01,0x85,0xd1,0xf8,0x00,0x00,0x20]77 78v_ceil_f16_e64 v0, neg(|v1|)79// CHECK: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]80 81v_ceil_f16_e64 v0, -|v1|82// CHECK: [0x00,0x01,0x85,0xd1,0x01,0x01,0x00,0x20]83 84//---------------------------------------------------------------------------//85// VOP1/VOP3 F6486//---------------------------------------------------------------------------//87 88// Encoded as inline constant 1 with 'neg' modifier89v_ceil_f64 v[0:1], neg(1)90// CHECK: [0x00,0x00,0x58,0xd1,0x81,0x00,0x00,0x20]91 92// Encoded as inline constant -1 with 'neg' modifier93v_ceil_f64 v[0:1], neg(-1)94// CHECK: [0x00,0x00,0x58,0xd1,0xc1,0x00,0x00,0x20]95 96v_ceil_f64_e32 v[0:1], 1.097// CHECK: [0xf2,0x30,0x00,0x7e]98 99// abs(1.0) = 1.0100v_ceil_f64_e32 v[0:1], abs(1.0)101// CHECK: [0xf2,0x30,0x00,0x7e]102 103// neg(1.0) = -1.0104v_ceil_f64_e32 v[0:1], neg(1.0)105// CHECK: [0xf3,0x30,0x00,0x7e]106 107// 1/(2*pi) encoded as inline constant in VOP1108v_ceil_f64 v[0:1], 0x3fc45f306dc9c882109// CHECK: [0xf8,0x30,0x00,0x7e]110 111// 1/(2*pi) encoded as inline constant in VOP3112v_ceil_f64_e64 v[0:1], 0x3fc45f306dc9c882113// CHECK: [0x00,0x00,0x58,0xd1,0xf8,0x00,0x00,0x00]114 115// -1/(2*pi) cannot be encoded as inline constant in VOP1.116// It cannot be encoded as literal either due to int literal rules.117// So it is encoded as VOP3118v_ceil_f64 v[0:1], abs(0x3fc45f306dc9c882)119// CHECK: [0x00,0x01,0x58,0xd1,0xf8,0x00,0x00,0x00]120 121v_ceil_f64 v[0:1], neg(abs(0x3fc45f306dc9c882))122// CHECK: [0x00,0x01,0x58,0xd1,0xf8,0x00,0x00,0x20]123 124 125//---------------------------------------------------------------------------//126// VOP2/VOP3 F32127//---------------------------------------------------------------------------//128 129v_add_f32 v5, -1, v2130// CHECK: [0xc1,0x04,0x0a,0x02]131 132v_add_f32 v5, -16, v2133// CHECK: [0xd0,0x04,0x0a,0x02]134 135v_add_f32 v5, 0x3e22f983, v2136// CHECK: [0xf8,0x04,0x0a,0x02]137 138// abs(1/(2*pi)) = 1/(2*pi)139v_add_f32 v5, abs(0x3e22f983), v2140// CHECK: [0xf8,0x04,0x0a,0x02]141 142// neg(-1/(2*pi)) = 1/(2*pi)143v_add_f32 v5, neg(0xbe22f983), v2144// CHECK: [0xf8,0x04,0x0a,0x02]145 146// -1/(2*pi) cannot be encoded as inline constant in VOP1147v_add_f32 v5, neg(0x3e22f983), v2148// CHECK: [0xff,0x04,0x0a,0x02,0x83,0xf9,0x22,0xbe]149 150 151v_add_f32_e64 v0, -2, s0152// CHECK: [0x00,0x00,0x01,0xd1,0xc2,0x00,0x00,0x00]153 154v_add_f32_e64 v0, -16, s0155// CHECK: [0x00,0x00,0x01,0xd1,0xd0,0x00,0x00,0x00]156 157v_add_f32_e64 v0, -0.5, s0158// CHECK: [0x00,0x00,0x01,0xd1,0xf1,0x00,0x00,0x00]159 160v_add_f32_e64 v0, -1.0, s0161// CHECK: [0x00,0x00,0x01,0xd1,0xf3,0x00,0x00,0x00]162 163v_add_f32_e64 v0, -2.0, s0164// CHECK: [0x00,0x00,0x01,0xd1,0xf5,0x00,0x00,0x00]165 166v_add_f32_e64 v0, -4.0, s0167// CHECK: [0x00,0x00,0x01,0xd1,0xf7,0x00,0x00,0x00]168 169v_add_f32_e64 v0, 0x3e22f983, s0170// CHECK: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x00]171 172v_add_f32_e64 v0, neg(0x3e22f983), s0173// CHECK: [0x00,0x00,0x01,0xd1,0xf8,0x00,0x00,0x20]174 175//---------------------------------------------------------------------------//176// VOPC/VOP3177//---------------------------------------------------------------------------//178 179v_cmp_eq_f16 vcc, -1, v0180// CHECK: [0xc1,0x00,0x44,0x7c]181 182v_cmp_eq_f16_e64 s[0:1], s0, -1183// CHECK: [0x00,0x00,0x22,0xd0,0x00,0x82,0x01,0x00]184 185v_cmp_eq_f16_e64 s[0:1], s0, 0x3118186// CHECK: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x00]187 188v_cmp_eq_f16_e64 s[0:1], s0, neg(0x3118)189// CHECK: [0x00,0x00,0x22,0xd0,0x00,0xf0,0x01,0x40]190 191v_cmp_eq_f32 vcc, -4.0, v0192// CHECK: [0xf7,0x00,0x84,0x7c]193 194// 1/(2*pi) can be encoded as inline constant195v_cmp_eq_f32 vcc, 0x3e22f983, v0196// CHECK: [0xf8,0x00,0x84,0x7c]197 198// -1/(2*pi) cannot be encoded as inline constant in VOPC199v_cmp_eq_f32 vcc, neg(0x3e22f983), v0200// CHECK: [0xff,0x00,0x84,0x7c,0x83,0xf9,0x22,0xbe]201 202// abs(1/(2*pi)) = 1/(2*pi)203v_cmp_eq_f32 vcc, abs(0x3e22f983), v0204// CHECK: [0xf8,0x00,0x84,0x7c]205 206// -1/(2*pi) can be encoded as inline constant w/ modifiers in VOP3207v_cmp_eq_f32_e64 vcc, neg(0x3e22f983), v0208// CHECK: [0x6a,0x00,0x42,0xd0,0xf8,0x00,0x02,0x20]209 210v_cmp_eq_f32_e64 vcc, v0, abs(0x3e22f983)211// CHECK: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x00]212 213v_cmp_eq_f32_e64 vcc, v0, -abs(0x3e22f983)214// CHECK: [0x6a,0x02,0x42,0xd0,0x00,0xf1,0x01,0x40]215 216//---------------------------------------------------------------------------//217// VOP3218//---------------------------------------------------------------------------//219 220v_add_f64 v[0:1], s[0:1], -1221// CHECK: [0x00,0x00,0x80,0xd2,0x00,0x82,0x01,0x00]222 223v_add_f64 v[0:1], s[0:1], -16224// CHECK: [0x00,0x00,0x80,0xd2,0x00,0xa0,0x01,0x00]225 226v_add_f64 v[0:1], s[0:1], -0.5227// CHECK: [0x00,0x00,0x80,0xd2,0x00,0xe2,0x01,0x00]228 229v_add_f64 v[0:1], s[0:1], -1.0230// CHECK: [0x00,0x00,0x80,0xd2,0x00,0xe6,0x01,0x00]231 232v_add_f64 v[0:1], s[0:1], -2.0233// CHECK: [0x00,0x00,0x80,0xd2,0x00,0xea,0x01,0x00]234 235v_add_f64 v[0:1], s[0:1], -4.0236// CHECK: [0x00,0x00,0x80,0xd2,0x00,0xee,0x01,0x00]237 238v_add_f64 v[4:5], s[0:1], 0x3fc45f306dc9c882239// CHECK: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x00]240 241v_add_f64 v[4:5], s[0:1], neg(0x3fc45f306dc9c882)242// CHECK: [0x04,0x00,0x80,0xd2,0x00,0xf0,0x01,0x40]243 244 245v_cubeid_f32 v0, s0, s0, -1246// CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0x04,0x03]247 248v_cubeid_f32 v0, s0, s0, -4.0249// CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xdc,0x03]250 251v_cubeid_f32 v0, s0, s0, 0x3e22f983252// CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x03]253 254v_cubeid_f32 v0, s0, s0, neg(0x3e22f983)255// CHECK: [0x00,0x00,0xc4,0xd1,0x00,0x00,0xe0,0x83]256 257v_cubeid_f32 v0, s0, s0, abs(0x3e22f983)258// CHECK: [0x00,0x04,0xc4,0xd1,0x00,0x00,0xe0,0x03]259 260 261//---------------------------------------------------------------------------//262// VOP3 Instructions without Input Modifiers but with Output Modifiers263//---------------------------------------------------------------------------//264 265v_cvt_f64_i32_e64 v[5:6], s1 clamp266// CHECK: [0x05,0x80,0x44,0xd1,0x01,0x00,0x00,0x00]267 268v_cvt_f64_i32_e64 v[5:6], s1 mul:2269// CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x08]270 271v_cvt_f64_i32_e64 v[5:6], s1 mul:4272// CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x10]273 274v_cvt_f64_i32_e64 v[5:6], s1 div:2275// CHECK: [0x05,0x00,0x44,0xd1,0x01,0x00,0x00,0x18]276 277 278v_cvt_f64_u32_e64 v[5:6], s1 clamp279// CHECK: [0x05,0x80,0x56,0xd1,0x01,0x00,0x00,0x00]280 281v_cvt_f64_u32_e64 v[5:6], s1 mul:2282// CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x08]283 284v_cvt_f64_u32_e64 v[5:6], s1 mul:4285// CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x10]286 287v_cvt_f64_u32_e64 v[5:6], s1 div:2288// CHECK: [0x05,0x00,0x56,0xd1,0x01,0x00,0x00,0x18]289 290 291v_cvt_f32_i32_e64 v5, s1 clamp292// CHECK: [0x05,0x80,0x45,0xd1,0x01,0x00,0x00,0x00]293 294v_cvt_f32_i32_e64 v5, s1 mul:2295// CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x08]296 297v_cvt_f32_i32_e64 v5, s1 mul:4298// CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x10]299 300v_cvt_f32_i32_e64 v5, s1 div:2301// CHECK: [0x05,0x00,0x45,0xd1,0x01,0x00,0x00,0x18]302 303 304v_cvt_f32_u32_e64 v5, s1 clamp305// CHECK: [0x05,0x80,0x46,0xd1,0x01,0x00,0x00,0x00]306 307v_cvt_f32_u32_e64 v5, s1 mul:2308// CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x08]309 310v_cvt_f32_u32_e64 v5, s1 mul:4311// CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x10]312 313v_cvt_f32_u32_e64 v5, s1 div:2314// CHECK: [0x05,0x00,0x46,0xd1,0x01,0x00,0x00,0x18]315 316 317v_cvt_off_f32_i4_e64 v5, s1 clamp318// CHECK: [0x05,0x80,0x4e,0xd1,0x01,0x00,0x00,0x00]319 320v_cvt_off_f32_i4_e64 v5, s1 mul:2321// CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x08]322 323v_cvt_off_f32_i4_e64 v5, s1 mul:4324// CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x10]325 326v_cvt_off_f32_i4_e64 v5, s1 div:2327// CHECK: [0x05,0x00,0x4e,0xd1,0x01,0x00,0x00,0x18]328 329 330v_cvt_f32_ubyte0_e64 v5, s1 clamp331// CHECK: [0x05,0x80,0x51,0xd1,0x01,0x00,0x00,0x00]332 333v_cvt_f32_ubyte0_e64 v5, s1 mul:2334// CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x08]335 336v_cvt_f32_ubyte0_e64 v5, s1 mul:4337// CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x10]338 339v_cvt_f32_ubyte0_e64 v5, s1 div:2340// CHECK: [0x05,0x00,0x51,0xd1,0x01,0x00,0x00,0x18]341 342 343v_cvt_f32_ubyte1_e64 v5, s1 clamp344// CHECK: [0x05,0x80,0x52,0xd1,0x01,0x00,0x00,0x00]345 346v_cvt_f32_ubyte1_e64 v5, s1 mul:2347// CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x08]348 349v_cvt_f32_ubyte1_e64 v5, s1 mul:4350// CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x10]351 352v_cvt_f32_ubyte1_e64 v5, s1 div:2353// CHECK: [0x05,0x00,0x52,0xd1,0x01,0x00,0x00,0x18]354 355 356v_cvt_f32_ubyte2_e64 v5, s1 clamp357// CHECK: [0x05,0x80,0x53,0xd1,0x01,0x00,0x00,0x00]358 359v_cvt_f32_ubyte2_e64 v5, s1 mul:2360// CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x08]361 362v_cvt_f32_ubyte2_e64 v5, s1 mul:4363// CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x10]364 365v_cvt_f32_ubyte2_e64 v5, s1 div:2366// CHECK: [0x05,0x00,0x53,0xd1,0x01,0x00,0x00,0x18]367 368 369v_cvt_f32_ubyte3_e64 v5, s1 clamp370// CHECK: [0x05,0x80,0x54,0xd1,0x01,0x00,0x00,0x00]371 372v_cvt_f32_ubyte3_e64 v5, s1 mul:2373// CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x08]374 375v_cvt_f32_ubyte3_e64 v5, s1 mul:4376// CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x10]377 378v_cvt_f32_ubyte3_e64 v5, s1 div:2379// CHECK: [0x05,0x00,0x54,0xd1,0x01,0x00,0x00,0x18]380 381 382// NB: output modifiers are not supported for f16383v_cvt_f16_i16_e64 v5, s1 clamp384// CHECK: [0x05,0x80,0x7a,0xd1,0x01,0x00,0x00,0x00]385 386// NB: output modifiers are not supported for f16387v_cvt_f16_u16_e64 v5, s1 clamp388// CHECK: [0x05,0x80,0x79,0xd1,0x01,0x00,0x00,0x00]389 390v_cvt_f16_u16_e64 v5, s1 noclamp391// CHECK: [0x05,0x00,0x79,0xd1,0x01,0x00,0x00,0x00]392