1# RUN: llvm-mc %s -triple=riscv32 -riscv-no-aliases -show-encoding \ 2# RUN: | FileCheck -check-prefixes=CHECK-INST,CHECK-ENC %s 3# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ 4# RUN: | llvm-objdump -d - \ 5# RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s 6 7###################################### 8# Machine Protection and Translation 9###################################### 10 11# pmpcfg1 12# name 13# CHECK-INST: csrrs t1, pmpcfg1, zero 14# CHECK-ENC: encoding: [0x73,0x23,0x10,0x3a] 15# CHECK-INST-ALIAS: csrr t1, pmpcfg1 16# uimm12 17# CHECK-INST: csrrs t2, pmpcfg1, zero 18# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x3a] 19# CHECK-INST-ALIAS: csrr t2, pmpcfg1 20# name 21csrrs t1, pmpcfg1, zero 22# uimm12 23csrrs t2, 0x3A1, zero 24 25# pmpcfg3 26# name 27# CHECK-INST: csrrs t1, pmpcfg3, zero 28# CHECK-ENC: encoding: [0x73,0x23,0x30,0x3a] 29# CHECK-INST-ALIAS: csrr t1, pmpcfg3 30# uimm12 31# CHECK-INST: csrrs t2, pmpcfg3, zero 32# CHECK-ENC: encoding: [0xf3,0x23,0x30,0x3a] 33# CHECK-INST-ALIAS: csrr t2, pmpcfg3 34# name 35csrrs t1, pmpcfg3, zero 36# uimm12 37csrrs t2, 0x3A3, zero 38 39###################################### 40# Machine Counter and Timers 41###################################### 42# mcycleh 43# name 44# CHECK-INST: csrrs t1, mcycleh, zero 45# CHECK-ENC: encoding: [0x73,0x23,0x00,0xb8] 46# CHECK-INST-ALIAS: csrr t1, mcycleh 47# uimm12 48# CHECK-INST: csrrs t2, mcycleh, zero 49# CHECK-ENC: encoding: [0xf3,0x23,0x00,0xb8] 50# CHECK-INST-ALIAS: csrr t2, mcycleh 51csrrs t1, mcycleh, zero 52# uimm12 53csrrs t2, 0xB80, zero 54 55# minstreth 56# name 57# CHECK-INST: csrrs t1, minstreth, zero 58# CHECK-ENC: encoding: [0x73,0x23,0x20,0xb8] 59# CHECK-INST-ALIAS: csrr t1, minstreth 60# uimm12 61# CHECK-INST: csrrs t2, minstreth, zero 62# CHECK-ENC: encoding: [0xf3,0x23,0x20,0xb8] 63# CHECK-INST-ALIAS: csrr t2, minstreth 64# name 65csrrs t1, minstreth, zero 66# uimm12 67csrrs t2, 0xB82, zero 68 69# mhpmcounter3h 70# name 71# CHECK-INST: csrrs t1, mhpmcounter3h, zero 72# CHECK-ENC: encoding: [0x73,0x23,0x30,0xb8] 73# CHECK-INST-ALIAS: csrr t1, mhpmcounter3h 74# uimm12 75# CHECK-INST: csrrs t2, mhpmcounter3h, zero 76# CHECK-ENC: encoding: [0xf3,0x23,0x30,0xb8] 77# CHECK-INST-ALIAS: csrr t2, mhpmcounter3h 78# name 79csrrs t1, mhpmcounter3h, zero 80# uimm12 81csrrs t2, 0xB83, zero 82 83# mhpmcounter4h 84# name 85# CHECK-INST: csrrs t1, mhpmcounter4h, zero 86# CHECK-ENC: encoding: [0x73,0x23,0x40,0xb8] 87# CHECK-INST-ALIAS: csrr t1, mhpmcounter4h 88# uimm12 89# CHECK-INST: csrrs t2, mhpmcounter4h, zero 90# CHECK-ENC: encoding: [0xf3,0x23,0x40,0xb8] 91# CHECK-INST-ALIAS: csrr t2, mhpmcounter4h 92# name 93csrrs t1, mhpmcounter4h, zero 94# uimm12 95csrrs t2, 0xB84, zero 96 97# mhpmcounter5h 98# name 99# CHECK-INST: csrrs t1, mhpmcounter5h, zero 100# CHECK-ENC: encoding: [0x73,0x23,0x50,0xb8] 101# CHECK-INST-ALIAS: csrr t1, mhpmcounter5h 102# uimm12 103# CHECK-INST: csrrs t2, mhpmcounter5h, zero 104# CHECK-ENC: encoding: [0xf3,0x23,0x50,0xb8] 105# CHECK-INST-ALIAS: csrr t2, mhpmcounter5h 106# name 107csrrs t1, mhpmcounter5h, zero 108# uimm12 109csrrs t2, 0xB85, zero 110 111# mhpmcounter6h 112# name 113# CHECK-INST: csrrs t1, mhpmcounter6h, zero 114# CHECK-ENC: encoding: [0x73,0x23,0x60,0xb8] 115# CHECK-INST-ALIAS: csrr t1, mhpmcounter6h 116# uimm12 117# CHECK-INST: csrrs t2, mhpmcounter6h, zero 118# CHECK-ENC: encoding: [0xf3,0x23,0x60,0xb8] 119# CHECK-INST-ALIAS: csrr t2, mhpmcounter6h 120# name 121csrrs t1, mhpmcounter6h, zero 122# uimm12 123csrrs t2, 0xB86, zero 124 125# mhpmcounter7h 126# name 127# CHECK-INST: csrrs t1, mhpmcounter7h, zero 128# CHECK-ENC: encoding: [0x73,0x23,0x70,0xb8] 129# CHECK-INST-ALIAS: csrr t1, mhpmcounter7h 130# uimm12 131# CHECK-INST: csrrs t2, mhpmcounter7h, zero 132# CHECK-ENC: encoding: [0xf3,0x23,0x70,0xb8] 133# CHECK-INST-ALIAS: csrr t2, mhpmcounter7h 134# name 135csrrs t1, mhpmcounter7h, zero 136# uimm12 137csrrs t2, 0xB87, zero 138 139# mhpmcounter8h 140# name 141# CHECK-INST: csrrs t1, mhpmcounter8h, zero 142# CHECK-ENC: encoding: [0x73,0x23,0x80,0xb8] 143# CHECK-INST-ALIAS: csrr t1, mhpmcounter8h 144# uimm12 145# CHECK-INST: csrrs t2, mhpmcounter8h, zero 146# CHECK-ENC: encoding: [0xf3,0x23,0x80,0xb8] 147# CHECK-INST-ALIAS: csrr t2, mhpmcounter8h 148# name 149csrrs t1, mhpmcounter8h, zero 150# uimm12 151csrrs t2, 0xB88, zero 152 153# mhpmcounter9h 154# name 155# CHECK-INST: csrrs t1, mhpmcounter9h, zero 156# CHECK-ENC: encoding: [0x73,0x23,0x90,0xb8] 157# CHECK-INST-ALIAS: csrr t1, mhpmcounter9h 158# uimm12 159# CHECK-INST: csrrs t2, mhpmcounter9h, zero 160# CHECK-ENC: encoding: [0xf3,0x23,0x90,0xb8] 161# CHECK-INST-ALIAS: csrr t2, mhpmcounter9h 162# name 163csrrs t1, mhpmcounter9h, zero 164# uimm12 165csrrs t2, 0xB89, zero 166 167# mhpmcounter10h 168# name 169# CHECK-INST: csrrs t1, mhpmcounter10h, zero 170# CHECK-ENC: encoding: [0x73,0x23,0xa0,0xb8] 171# CHECK-INST-ALIAS: csrr t1, mhpmcounter10h 172# uimm12 173# CHECK-INST: csrrs t2, mhpmcounter10h, zero 174# CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xb8] 175# CHECK-INST-ALIAS: csrr t2, mhpmcounter10h 176# name 177csrrs t1, mhpmcounter10h, zero 178# uimm12 179csrrs t2, 0xB8A, zero 180 181# mhpmcounter11h 182# name 183# CHECK-INST: csrrs t1, mhpmcounter11h, zero 184# CHECK-ENC: encoding: [0x73,0x23,0xb0,0xb8] 185# CHECK-INST-ALIAS: csrr t1, mhpmcounter11h 186# uimm12 187# CHECK-INST: csrrs t2, mhpmcounter11h, zero 188# CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xb8] 189# CHECK-INST-ALIAS: csrr t2, mhpmcounter11h 190# name 191csrrs t1, mhpmcounter11h, zero 192# uimm12 193csrrs t2, 0xB8B, zero 194 195# mhpmcounter12h 196# name 197# CHECK-INST: csrrs t1, mhpmcounter12h, zero 198# CHECK-ENC: encoding: [0x73,0x23,0xc0,0xb8] 199# CHECK-INST-ALIAS: csrr t1, mhpmcounter12h 200# uimm12 201# CHECK-INST: csrrs t2, mhpmcounter12h, zero 202# CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xb8] 203# CHECK-INST-ALIAS: csrr t2, mhpmcounter12h 204# name 205csrrs t1, mhpmcounter12h, zero 206# uimm12 207csrrs t2, 0xB8C, zero 208 209# mhpmcounter13h 210# name 211# CHECK-INST: csrrs t1, mhpmcounter13h, zero 212# CHECK-ENC: encoding: [0x73,0x23,0xd0,0xb8] 213# CHECK-INST-ALIAS: csrr t1, mhpmcounter13h 214# uimm12 215# CHECK-INST: csrrs t2, mhpmcounter13h, zero 216# CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xb8] 217# CHECK-INST-ALIAS: csrr t2, mhpmcounter13h 218# name 219csrrs t1, mhpmcounter13h, zero 220# uimm12 221csrrs t2, 0xB8D, zero 222 223# mhpmcounter14h 224# name 225# CHECK-INST: csrrs t1, mhpmcounter14h, zero 226# CHECK-ENC: encoding: [0x73,0x23,0xe0,0xb8] 227# CHECK-INST-ALIAS: csrr t1, mhpmcounter14h 228# uimm12 229# CHECK-INST: csrrs t2, mhpmcounter14h, zero 230# CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xb8] 231# CHECK-INST-ALIAS: csrr t2, mhpmcounter14h 232# name 233csrrs t1, mhpmcounter14h, zero 234# uimm12 235csrrs t2, 0xB8E, zero 236 237# mhpmcounter15h 238# name 239# CHECK-INST: csrrs t1, mhpmcounter15h, zero 240# CHECK-ENC: encoding: [0x73,0x23,0xf0,0xb8] 241# CHECK-INST-ALIAS: csrr t1, mhpmcounter15h 242# uimm12 243# CHECK-INST: csrrs t2, mhpmcounter15h, zero 244# CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xb8] 245# CHECK-INST-ALIAS: csrr t2, mhpmcounter15h 246# name 247csrrs t1, mhpmcounter15h, zero 248# uimm12 249csrrs t2, 0xB8F, zero 250 251# mhpmcounter16h 252# name 253# CHECK-INST: csrrs t1, mhpmcounter16h, zero 254# CHECK-ENC: encoding: [0x73,0x23,0x00,0xb9] 255# CHECK-INST-ALIAS: csrr t1, mhpmcounter16h 256# uimm12 257# CHECK-INST: csrrs t2, mhpmcounter16h, zero 258# CHECK-ENC: encoding: [0xf3,0x23,0x00,0xb9] 259# CHECK-INST-ALIAS: csrr t2, mhpmcounter16h 260# name 261csrrs t1, mhpmcounter16h, zero 262# uimm12 263csrrs t2, 0xB90, zero 264 265# mhpmcounter17h 266# name 267# CHECK-INST: csrrs t1, mhpmcounter17h, zero 268# CHECK-ENC: encoding: [0x73,0x23,0x10,0xb9] 269# CHECK-INST-ALIAS: csrr t1, mhpmcounter17h 270# uimm12 271# CHECK-INST: csrrs t2, mhpmcounter17h, zero 272# CHECK-ENC: encoding: [0xf3,0x23,0x10,0xb9] 273# CHECK-INST-ALIAS: csrr t2, mhpmcounter17h 274# name 275csrrs t1, mhpmcounter17h, zero 276# uimm12 277csrrs t2, 0xB91, zero 278 279# mhpmcounter18h 280# name 281# CHECK-INST: csrrs t1, mhpmcounter18h, zero 282# CHECK-ENC: encoding: [0x73,0x23,0x20,0xb9] 283# CHECK-INST-ALIAS: csrr t1, mhpmcounter18h 284# uimm12 285# CHECK-INST: csrrs t2, mhpmcounter18h, zero 286# CHECK-ENC: encoding: [0xf3,0x23,0x20,0xb9] 287# CHECK-INST-ALIAS: csrr t2, mhpmcounter18h 288# name 289csrrs t1, mhpmcounter18h, zero 290# uimm12 291csrrs t2, 0xB92, zero 292 293# mhpmcounter19h 294# name 295# CHECK-INST: csrrs t1, mhpmcounter19h, zero 296# CHECK-ENC: encoding: [0x73,0x23,0x30,0xb9] 297# CHECK-INST-ALIAS: csrr t1, mhpmcounter19h 298# uimm12 299# CHECK-INST: csrrs t2, mhpmcounter19h, zero 300# CHECK-ENC: encoding: [0xf3,0x23,0x30,0xb9] 301# CHECK-INST-ALIAS: csrr t2, mhpmcounter19h 302# name 303csrrs t1, mhpmcounter19h, zero 304# uimm12 305csrrs t2, 0xB93, zero 306 307# mhpmcounter20h 308# name 309# CHECK-INST: csrrs t1, mhpmcounter20h, zero 310# CHECK-ENC: encoding: [0x73,0x23,0x40,0xb9] 311# CHECK-INST-ALIAS: csrr t1, mhpmcounter20h 312# uimm12 313# CHECK-INST: csrrs t2, mhpmcounter20h, zero 314# CHECK-ENC: encoding: [0xf3,0x23,0x40,0xb9] 315# CHECK-INST-ALIAS: csrr t2, mhpmcounter20h 316# name 317csrrs t1, mhpmcounter20h, zero 318# uimm12 319csrrs t2, 0xB94, zero 320 321# mhpmcounter21h 322# name 323# CHECK-INST: csrrs t1, mhpmcounter21h, zero 324# CHECK-ENC: encoding: [0x73,0x23,0x50,0xb9] 325# CHECK-INST-ALIAS: csrr t1, mhpmcounter21h 326# uimm12 327# CHECK-INST: csrrs t2, mhpmcounter21h, zero 328# CHECK-ENC: encoding: [0xf3,0x23,0x50,0xb9] 329# CHECK-INST-ALIAS: csrr t2, mhpmcounter21h 330# name 331csrrs t1, mhpmcounter21h, zero 332# uimm12 333csrrs t2, 0xB95, zero 334 335# mhpmcounter22h 336# name 337# CHECK-INST: csrrs t1, mhpmcounter22h, zero 338# CHECK-ENC: encoding: [0x73,0x23,0x60,0xb9] 339# CHECK-INST-ALIAS: csrr t1, mhpmcounter22h 340# uimm12 341# CHECK-INST: csrrs t2, mhpmcounter22h, zero 342# CHECK-ENC: encoding: [0xf3,0x23,0x60,0xb9] 343# CHECK-INST-ALIAS: csrr t2, mhpmcounter22h 344# name 345csrrs t1, mhpmcounter22h, zero 346# uimm12 347csrrs t2, 0xB96, zero 348 349# mhpmcounter23h 350# name 351# CHECK-INST: csrrs t1, mhpmcounter23h, zero 352# CHECK-ENC: encoding: [0x73,0x23,0x70,0xb9] 353# CHECK-INST-ALIAS: csrr t1, mhpmcounter23h 354# uimm12 355# CHECK-INST: csrrs t2, mhpmcounter23h, zero 356# CHECK-ENC: encoding: [0xf3,0x23,0x70,0xb9] 357# CHECK-INST-ALIAS: csrr t2, mhpmcounter23h 358# name 359csrrs t1, mhpmcounter23h, zero 360# uimm12 361csrrs t2, 0xB97, zero 362 363# mhpmcounter24h 364# name 365# CHECK-INST: csrrs t1, mhpmcounter24h, zero 366# CHECK-ENC: encoding: [0x73,0x23,0x80,0xb9] 367# CHECK-INST-ALIAS: csrr t1, mhpmcounter24h 368# uimm12 369# CHECK-INST: csrrs t2, mhpmcounter24h, zero 370# CHECK-ENC: encoding: [0xf3,0x23,0x80,0xb9] 371# CHECK-INST-ALIAS: csrr t2, mhpmcounter24h 372# name 373csrrs t1, mhpmcounter24h, zero 374# uimm12 375csrrs t2, 0xB98, zero 376 377# mhpmcounter25h 378# name 379# CHECK-INST: csrrs t1, mhpmcounter25h, zero 380# CHECK-ENC: encoding: [0x73,0x23,0x90,0xb9] 381# CHECK-INST-ALIAS: csrr t1, mhpmcounter25h 382# uimm12 383# CHECK-INST: csrrs t2, mhpmcounter25h, zero 384# CHECK-ENC: encoding: [0xf3,0x23,0x90,0xb9] 385# CHECK-INST-ALIAS: csrr t2, mhpmcounter25h 386# name 387csrrs t1, mhpmcounter25h, zero 388# uimm12 389csrrs t2, 0xB99, zero 390 391# mhpmcounter26h 392# name 393# CHECK-INST: csrrs t1, mhpmcounter26h, zero 394# CHECK-ENC: encoding: [0x73,0x23,0xa0,0xb9] 395# CHECK-INST-ALIAS: csrr t1, mhpmcounter26h 396# uimm12 397# CHECK-INST: csrrs t2, mhpmcounter26h, zero 398# CHECK-ENC: encoding: [0xf3,0x23,0xa0,0xb9] 399# CHECK-INST-ALIAS: csrr t2, mhpmcounter26h 400# name 401csrrs t1, mhpmcounter26h, zero 402# uimm12 403csrrs t2, 0xB9A, zero 404 405# mhpmcounter27h 406# name 407# CHECK-INST: csrrs t1, mhpmcounter27h, zero 408# CHECK-ENC: encoding: [0x73,0x23,0xb0,0xb9] 409# CHECK-INST-ALIAS: csrr t1, mhpmcounter27h 410# uimm12 411# CHECK-INST: csrrs t2, mhpmcounter27h, zero 412# CHECK-ENC: encoding: [0xf3,0x23,0xb0,0xb9] 413# CHECK-INST-ALIAS: csrr t2, mhpmcounter27h 414# name 415csrrs t1, mhpmcounter27h, zero 416# uimm12 417csrrs t2, 0xB9B, zero 418 419# mhpmcounter28h 420# name 421# CHECK-INST: csrrs t1, mhpmcounter28h, zero 422# CHECK-ENC: encoding: [0x73,0x23,0xc0,0xb9] 423# CHECK-INST-ALIAS: csrr t1, mhpmcounter28h 424# uimm12 425# CHECK-INST: csrrs t2, mhpmcounter28h, zero 426# CHECK-ENC: encoding: [0xf3,0x23,0xc0,0xb9] 427# CHECK-INST-ALIAS: csrr t2, mhpmcounter28h 428# name 429csrrs t1, mhpmcounter28h, zero 430# uimm12 431csrrs t2, 0xB9C, zero 432 433# mhpmcounter29h 434# name 435# CHECK-INST: csrrs t1, mhpmcounter29h, zero 436# CHECK-ENC: encoding: [0x73,0x23,0xd0,0xb9] 437# CHECK-INST-ALIAS: csrr t1, mhpmcounter29h 438# uimm12 439# CHECK-INST: csrrs t2, mhpmcounter29h, zero 440# CHECK-ENC: encoding: [0xf3,0x23,0xd0,0xb9] 441# CHECK-INST-ALIAS: csrr t2, mhpmcounter29h 442# name 443csrrs t1, mhpmcounter29h, zero 444# uimm12 445csrrs t2, 0xB9D, zero 446 447# mhpmcounter30h 448# name 449# CHECK-INST: csrrs t1, mhpmcounter30h, zero 450# CHECK-ENC: encoding: [0x73,0x23,0xe0,0xb9] 451# CHECK-INST-ALIAS: csrr t1, mhpmcounter30h 452# uimm12 453# CHECK-INST: csrrs t2, mhpmcounter30h, zero 454# CHECK-ENC: encoding: [0xf3,0x23,0xe0,0xb9] 455# CHECK-INST-ALIAS: csrr t2, mhpmcounter30h 456# name 457csrrs t1, mhpmcounter30h, zero 458# uimm12 459csrrs t2, 0xB9E, zero 460 461# mhpmcounter31h 462# name 463# CHECK-INST: csrrs t1, mhpmcounter31h, zero 464# CHECK-ENC: encoding: [0x73,0x23,0xf0,0xb9] 465# CHECK-INST-ALIAS: csrr t1, mhpmcounter31h 466# uimm12 467# CHECK-INST: csrrs t2, mhpmcounter31h, zero 468# CHECK-ENC: encoding: [0xf3,0x23,0xf0,0xb9] 469# CHECK-INST-ALIAS: csrr t2, mhpmcounter31h 470# name 471csrrs t1, mhpmcounter31h, zero 472# uimm12 473csrrs t2, 0xB9F, zero 474 475