Class: AArch64::Assembler

Inherits:
Object
  • Object
show all
Includes:
Instructions, Registers
Defined in:
lib/aarch64.rb

Defined Under Namespace

Classes: Label

Constant Summary

Constants included from Registers

Registers::SP, Registers::WSP, Registers::WZR, Registers::XZR

Instance Method Summary collapse

Constructor Details

#initializeAssembler

Returns a new instance of Assembler.



142
143
144
# File 'lib/aarch64.rb', line 142

def initialize
  @insns = []
end

Instance Method Details

#adc(d, n, m) ⇒ Object



168
169
170
# File 'lib/aarch64.rb', line 168

def adc d, n, m
  a ADC.new(d, n, m, d.sf)
end

#adcs(d, n, m) ⇒ Object



172
173
174
# File 'lib/aarch64.rb', line 172

def adcs d, n, m
  a ADCS.new(d, n, m, d.sf)
end

#add(d, n, m, extend: nil, amount: 0, lsl: 0, shift: :lsl) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/aarch64.rb', line 176

def add d, n, m, extend: nil, amount: 0, lsl: 0, shift: :lsl
  if extend
    extend = case extend
             when :uxtb then 0b000
             when :uxth then 0b001
             when :uxtw then 0b010
             when :uxtx then 0b011
             when :sxtb then 0b100
             when :sxth then 0b101
             when :sxtw then 0b110
             when :sxtx then 0b111
             else
               raise "Unknown extend #{extend}"
             end

    if m.x?
      if (extend & 0x3 != 0x3)
        raise "Wrong extend"
      end
    else
      if (extend & 0x3 == 0x3)
        raise "Wrong extend"
      end
    end

    a ADD_addsub_ext.new(d, n, m, extend, amount, d.sf)
  else
    if m.integer?
      # add immediate
      a ADD_addsub_imm.new(d, n, m, lsl / 12, d.sf)
    else
      shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
      a ADD_addsub_shift.new(d, n, m, shift, amount, d.sf)
    end
  end
end

#addg(xd, xn, imm6, imm4) ⇒ Object



213
214
215
# File 'lib/aarch64.rb', line 213

def addg xd, xn, imm6, imm4
  a ADDG.new(xd, xn, imm6, imm4)
end

#adds(d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl) ⇒ Object



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/aarch64.rb', line 217

def adds d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl
  if n.sp? && !m.integer?
    if n.x?
      extend ||= :uxtx
    else
      extend ||= :uxtw
    end
  end

  if option
    if option.extend?
      extend = option.name
      amount = option.amount
    else
      if m.integer?
        lsl = option.amount
      else
        shift = option.name
        amount = option.amount
      end
    end
  end

  if extend
    extend = case extend
             when :uxtb then 0b000
             when :uxth then 0b001
             when :uxtw then 0b010
             when :uxtx then 0b011
             when :sxtb then 0b100
             when :sxth then 0b101
             when :sxtw then 0b110
             when :sxtx then 0b111
             else
               raise "Unknown extend #{extend}"
             end
    a ADDS_addsub_ext.new(d, n, m, extend, amount, d.sf)
  else
    if m.integer?
      a ADDS_addsub_imm.new(d, n, m, lsl / 12, d.sf)
    else
      shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
      a ADDS_addsub_shift.new(d, n, m, shift, amount, d.sf)
    end
  end
end

#adr(xd, label) ⇒ Object



264
265
266
# File 'lib/aarch64.rb', line 264

def adr xd, label
  a ADR.new(xd, label)
end

#adrp(xd, label) ⇒ Object



268
269
270
# File 'lib/aarch64.rb', line 268

def adrp xd, label
  a ADRP.new(xd, label)
end

#and(d, n, m, shift: :lsl, amount: 0) ⇒ Object



272
273
274
275
276
277
278
279
280
# File 'lib/aarch64.rb', line 272

def and d, n, m, shift: :lsl, amount: 0
  if m.integer?
    enc = Utils.encode_mask(m, d.size) || raise("Can't encode mask #{m}")
    a AND_log_imm.new(d, n, enc.immr, enc.imms, enc.n, d.sf)
  else
    shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
    a AND_log_shift.new(d, n, m, shift, amount, d.sf)
  end
end

#ands(d, n, m, shift: :lsl, amount: 0) ⇒ Object



282
283
284
285
286
287
288
289
290
# File 'lib/aarch64.rb', line 282

def ands d, n, m, shift: :lsl, amount: 0
  if m.integer?
    enc = Utils.encode_mask(m, d.size) || raise("Can't encode mask #{m}")
    a ANDS_log_imm.new(d, n, enc.immr, enc.imms, enc.n, d.sf)
  else
    shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
    a ANDS_log_shift.new(d, n, m, shift, amount, d.sf)
  end
end

#asr(d, n, m) ⇒ Object



292
293
294
295
296
297
298
# File 'lib/aarch64.rb', line 292

def asr d, n, m
  if m.integer?
    sbfm d, n, m, d.size - 1
  else
    asrv d, n, m
  end
end

#asrv(d, n, m) ⇒ Object



300
301
302
# File 'lib/aarch64.rb', line 300

def asrv d, n, m
  a ASRV.new(d, n, m, d.sf)
end

#at(at_op, t) ⇒ Object



304
305
306
307
# File 'lib/aarch64.rb', line 304

def at at_op, t
  op = Utils.at_op(at_op)
  sys op[:op1], Names::C7, op[:crm], op[:op2], t
end

#autda(d, n) ⇒ Object



309
310
311
# File 'lib/aarch64.rb', line 309

def autda d, n
  a AUTDA.new(d, n)
end

#autdb(d, n) ⇒ Object



317
318
319
# File 'lib/aarch64.rb', line 317

def autdb d, n
  a AUTDB.new(d, n)
end

#autdza(d) ⇒ Object



313
314
315
# File 'lib/aarch64.rb', line 313

def autdza d
  a AUTDA.new(d, 0b11111)
end

#autdzb(d) ⇒ Object



321
322
323
# File 'lib/aarch64.rb', line 321

def autdzb d
  a AUTDB.new(d, 0b11111)
end

#autia(d, n) ⇒ Object



325
326
327
# File 'lib/aarch64.rb', line 325

def autia d, n
  a AUTIA.new(d, n)
end

#autia1716Object



333
334
335
# File 'lib/aarch64.rb', line 333

def autia1716
  a HINT.new(0b0001, 0b100)
end

#autiaspObject



337
338
339
# File 'lib/aarch64.rb', line 337

def autiasp
  a HINT.new(0b0011, 0b101)
end

#autiazObject



341
342
343
# File 'lib/aarch64.rb', line 341

def autiaz
  a HINT.new(0b0011, 0b100)
end

#autib(d, n) ⇒ Object



345
346
347
# File 'lib/aarch64.rb', line 345

def autib d, n
  a AUTIB.new(d, n)
end

#autib1716Object



353
354
355
# File 'lib/aarch64.rb', line 353

def autib1716
  a HINT.new(0b0001, 0b110)
end

#autibspObject



357
358
359
# File 'lib/aarch64.rb', line 357

def autibsp
  a HINT.new(0b0011, 0b111)
end

#autibzObject



361
362
363
# File 'lib/aarch64.rb', line 361

def autibz
  a HINT.new(0b0011, 0b110)
end

#autiza(d) ⇒ Object



329
330
331
# File 'lib/aarch64.rb', line 329

def autiza d
  a AUTIA.new(d, 0b11111)
end

#autizb(d) ⇒ Object



349
350
351
# File 'lib/aarch64.rb', line 349

def autizb d
  a AUTIB.new(d, 0b11111)
end

#axflagObject



365
366
367
# File 'lib/aarch64.rb', line 365

def axflag
  a AXFLAG.new
end

#b(label, cond: nil) ⇒ Object



369
370
371
372
373
374
375
# File 'lib/aarch64.rb', line 369

def b label, cond: nil
  if cond
    a B_cond.new(cond, label)
  else
    a B_uncond.new(label)
  end
end

#bc(label, cond:) ⇒ Object



377
378
379
# File 'lib/aarch64.rb', line 377

def bc label, cond:
  a BC_cond.new(cond, label)
end

#bfc(rd, lsb, width) ⇒ Object



381
382
383
# File 'lib/aarch64.rb', line 381

def bfc rd, lsb, width
  bfm(rd, rd.zr, -lsb % rd.size, width - 1)
end

#bfi(rd, rn, lsb, width) ⇒ Object



385
386
387
# File 'lib/aarch64.rb', line 385

def bfi rd, rn, lsb, width
  bfm(rd, rn, -lsb % rd.size, width - 1)
end

#bfm(d, n, immr, imms) ⇒ Object



389
390
391
# File 'lib/aarch64.rb', line 389

def bfm d, n, immr, imms
  a BFM.new(d, n, immr, imms, d.sf)
end

#bfxil(d, n, lsb, width) ⇒ Object



393
394
395
# File 'lib/aarch64.rb', line 393

def bfxil d, n, lsb, width
  bfm d, n, lsb, lsb + width - 1
end

#bic(d, n, m, option = nil, shift: :lsl, amount: 0) ⇒ Object



397
398
399
400
401
402
403
404
405
# File 'lib/aarch64.rb', line 397

def bic d, n, m, option = nil, shift: :lsl, amount: 0
  if option
    shift = option.name
    amount = option.amount
  end

  shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)
  a BIC_log_shift.new(d, n, m, shift, amount, d.sf)
end

#bics(d, n, m, option = nil, shift: :lsl, amount: 0) ⇒ Object



407
408
409
410
411
412
413
414
415
# File 'lib/aarch64.rb', line 407

def bics d, n, m, option = nil, shift: :lsl, amount: 0
  if option
    shift = option.name
    amount = option.amount
  end

  shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)
  a BICS.new(d, n, m, shift, amount, d.sf)
end

#bl(label) ⇒ Object



417
418
419
# File 'lib/aarch64.rb', line 417

def bl label
  a BL.new(label)
end

#blr(n) ⇒ Object



421
422
423
# File 'lib/aarch64.rb', line 421

def blr n
  a BLR.new(n)
end

#blraa(rn, rm) ⇒ Object



429
430
431
# File 'lib/aarch64.rb', line 429

def blraa rn, rm
  a BLRA.new(rn, rm, 1, 0)
end

#blraaz(rn) ⇒ Object



425
426
427
# File 'lib/aarch64.rb', line 425

def blraaz rn
  a BLRA.new(rn, 0b11111, 0, 0)
end

#blrab(rn, rm) ⇒ Object



437
438
439
# File 'lib/aarch64.rb', line 437

def blrab rn, rm
  a BLRA.new(rn, rm, 1, 1)
end

#blrabz(rn) ⇒ Object



433
434
435
# File 'lib/aarch64.rb', line 433

def blrabz rn
  a BLRA.new(rn, 0b11111, 0, 1)
end

#br(rn) ⇒ Object



441
442
443
# File 'lib/aarch64.rb', line 441

def br rn
  a BR.new(rn)
end

#braa(rn, rm) ⇒ Object



449
450
451
# File 'lib/aarch64.rb', line 449

def braa rn, rm
  a BRA.new(rn, rm, 1, 0)
end

#braaz(rn) ⇒ Object



445
446
447
# File 'lib/aarch64.rb', line 445

def braaz rn
  a BRA.new(rn, 0b11111, 0, 0)
end

#brab(rn, rm) ⇒ Object



457
458
459
# File 'lib/aarch64.rb', line 457

def brab rn, rm
  a BRA.new(rn, rm, 1, 1)
end

#brabz(rn) ⇒ Object



453
454
455
# File 'lib/aarch64.rb', line 453

def brabz rn
  a BRA.new(rn, 0b11111, 0, 1)
end

#brk(imm) ⇒ Object



461
462
463
# File 'lib/aarch64.rb', line 461

def brk imm
  a BRK.new(imm)
end

#bti(target) ⇒ Object



465
466
467
468
# File 'lib/aarch64.rb', line 465

def bti target
  target = [:c, :j, :jc].index(target) || raise(NotImplementedError)
  a BTI.new(target)
end

#cas(s, t, n_list) ⇒ Object



470
471
472
# File 'lib/aarch64.rb', line 470

def cas s, t, n_list
  a CAS.new(s, t, n_list[0], 0, 0, s.sf)
end

#casa(s, t, n_list) ⇒ Object



474
475
476
# File 'lib/aarch64.rb', line 474

def casa s, t, n_list
  a CAS.new(s, t, n_list[0], 1, 0, s.sf)
end

#casah(rs, rt, rn_list) ⇒ Object



498
499
500
# File 'lib/aarch64.rb', line 498

def casah rs, rt, rn_list
  a CASH.new(rs, rt, rn_list[0], 1, 0)
end

#casal(s, t, n_list) ⇒ Object



482
483
484
# File 'lib/aarch64.rb', line 482

def casal s, t, n_list
  a CAS.new(s, t, n_list[0], 1, 1, s.sf)
end

#casalb(rs, rt, rn_list) ⇒ Object



490
491
492
# File 'lib/aarch64.rb', line 490

def casalb rs, rt, rn_list
  a CASB.new(rs, rt, rn_list[0], 1, 1)
end

#casalh(rs, rt, rn_list) ⇒ Object



502
503
504
# File 'lib/aarch64.rb', line 502

def casalh rs, rt, rn_list
  a CASH.new(rs, rt, rn_list[0], 1, 1)
end

#casb(rs, rt, rn_list) ⇒ Object



486
487
488
# File 'lib/aarch64.rb', line 486

def casb rs, rt, rn_list
  a CASB.new(rs, rt, rn_list[0], 0, 0)
end

#cash(rs, rt, rn_list) ⇒ Object



506
507
508
# File 'lib/aarch64.rb', line 506

def cash rs, rt, rn_list
  a CASH.new(rs, rt, rn_list[0], 0, 0)
end

#casl(s, t, n_list) ⇒ Object



478
479
480
# File 'lib/aarch64.rb', line 478

def casl s, t, n_list
  a CAS.new(s, t, n_list[0], 0, 1, s.sf)
end

#caslb(rs, rt, rn_list) ⇒ Object



494
495
496
# File 'lib/aarch64.rb', line 494

def caslb rs, rt, rn_list
  a CASB.new(rs, rt, rn_list[0], 0, 1)
end

#caslh(rs, rt, rn_list) ⇒ Object



510
511
512
# File 'lib/aarch64.rb', line 510

def caslh rs, rt, rn_list
  a CASH.new(rs, rt, rn_list[0], 0, 1)
end

#casp(rs, rs1, rt, rt1, rn_list) ⇒ Object



514
515
516
# File 'lib/aarch64.rb', line 514

def casp rs, rs1, rt, rt1, rn_list
  a CASP.new(rs, rt, rn_list[0], 0, 0, rs.sf)
end

#caspa(rs, rs1, rt, rt1, rn_list) ⇒ Object



518
519
520
# File 'lib/aarch64.rb', line 518

def caspa rs, rs1, rt, rt1, rn_list
  a CASP.new(rs, rt, rn_list[0], 1, 0, rs.sf)
end

#caspal(rs, rs1, rt, rt1, rn_list) ⇒ Object



526
527
528
# File 'lib/aarch64.rb', line 526

def caspal rs, rs1, rt, rt1, rn_list
  a CASP.new(rs, rt, rn_list[0], 1, 1, rs.sf)
end

#caspl(rs, rs1, rt, rt1, rn_list) ⇒ Object



522
523
524
# File 'lib/aarch64.rb', line 522

def caspl rs, rs1, rt, rt1, rn_list
  a CASP.new(rs, rt, rn_list[0], 0, 1, rs.sf)
end

#cbnz(rt, label) ⇒ Object



530
531
532
# File 'lib/aarch64.rb', line 530

def cbnz rt, label
  a CBNZ.new(rt, label, rt.sf)
end

#cbz(rt, label) ⇒ Object



534
535
536
# File 'lib/aarch64.rb', line 534

def cbz rt, label
  a CBZ.new(rt, label, rt.sf)
end

#ccmn(rn, rm, nzcv, cond) ⇒ Object



538
539
540
541
542
543
544
545
546
# File 'lib/aarch64.rb', line 538

def ccmn rn, rm, nzcv, cond
  cond = Utils.cond2bin(cond)

  if rm.integer?
    a CCMN_imm.new(rn, rm, nzcv, cond, rn.sf)
  else
    a CCMN_reg.new(rn, rm, nzcv, cond, rn.sf)
  end
end

#ccmp(rn, rm, nzcv, cond) ⇒ Object



548
549
550
551
552
553
554
555
556
# File 'lib/aarch64.rb', line 548

def ccmp rn, rm, nzcv, cond
  cond = Utils.cond2bin(cond)

  if rm.integer?
    a CCMP_imm.new(rn, rm, nzcv, cond, rn.sf)
  else
    a CCMP_reg.new(rn, rm, nzcv, cond, rn.sf)
  end
end

#cfinvObject



558
559
560
# File 'lib/aarch64.rb', line 558

def cfinv
  a CFINV.new
end

#cfp_rcfx(rt) ⇒ Object



562
563
564
# File 'lib/aarch64.rb', line 562

def cfp_rcfx rt
  sys 3, Names::C7, Names::C3, 4, rt
end

#cinc(rd, rn, cond) ⇒ Object



566
567
568
# File 'lib/aarch64.rb', line 566

def cinc rd, rn, cond
  a CSINC.new(rd, rn, rn, Utils.cond2bin(cond) ^ 1, rd.sf)
end

#cinv(rd, rn, cond) ⇒ Object



583
584
585
# File 'lib/aarch64.rb', line 583

def cinv rd, rn, cond
  a CSINV.new(rd, rn, rn, Utils.cond2bin(cond) ^ 1, rd.sf)
end

#clrex(imm = 15) ⇒ Object



591
592
593
# File 'lib/aarch64.rb', line 591

def clrex imm = 15
  a CLREX.new(imm)
end

#cls(rd, rn) ⇒ Object



595
596
597
# File 'lib/aarch64.rb', line 595

def cls rd, rn
  a CLS_int.new(rd, rn, rd.sf)
end

#clz(rd, rn) ⇒ Object



599
600
601
# File 'lib/aarch64.rb', line 599

def clz rd, rn
  a CLZ_int.new(rd, rn, rd.sf)
end

#cmn(rn, rm, option = nil, extend: nil, amount: 0, shift: :lsl, lsl: 0) ⇒ Object



603
604
605
# File 'lib/aarch64.rb', line 603

def cmn rn, rm, option = nil, extend: nil, amount: 0, shift: :lsl, lsl: 0
  adds(rn.zr, rn, rm, option, extend: extend, amount: amount, shift: shift, lsl: lsl)
end

#cmp(rn, rm, option = nil, extend: nil, amount: 0, shift: :lsl, lsl: 0) ⇒ Object



607
608
609
# File 'lib/aarch64.rb', line 607

def cmp rn, rm, option = nil, extend: nil, amount: 0, shift: :lsl, lsl: 0
  subs(rn.zr, rn, rm, option, extend: extend, amount: amount, shift: shift, lsl: lsl)
end

#cmpp(xn, xm) ⇒ Object



611
612
613
# File 'lib/aarch64.rb', line 611

def cmpp xn, xm
  subps XZR, xn, xm
end

#cneg(rd, rn, cond) ⇒ Object



615
616
617
# File 'lib/aarch64.rb', line 615

def cneg rd, rn, cond
  a CSNEG.new(rd, rn, rn, Utils.cond2bin(cond) ^ 1, rd.sf)
end

#cpp(_, xn) ⇒ Object



619
620
621
# File 'lib/aarch64.rb', line 619

def cpp _, xn
  sys 3, Names::C7, Names::C3, 7, xn
end

#crc32b(rd, rn, rm) ⇒ Object



623
624
625
# File 'lib/aarch64.rb', line 623

def crc32b rd, rn, rm
  a CRC32.new(rd, rn, rm, 0x00, 0b0)
end

#crc32cb(rd, rn, rm) ⇒ Object



639
640
641
# File 'lib/aarch64.rb', line 639

def crc32cb rd, rn, rm
  a CRC32C.new(rd, rn, rm, 0x00, 0b0)
end

#crc32ch(rd, rn, rm) ⇒ Object



643
644
645
# File 'lib/aarch64.rb', line 643

def crc32ch rd, rn, rm
  a CRC32C.new(rd, rn, rm, 0x01, 0b0)
end

#crc32cw(rd, rn, rm) ⇒ Object



647
648
649
# File 'lib/aarch64.rb', line 647

def crc32cw rd, rn, rm
  a CRC32C.new(rd, rn, rm, 0x02, 0b0)
end

#crc32cx(rd, rn, rm) ⇒ Object



651
652
653
# File 'lib/aarch64.rb', line 651

def crc32cx rd, rn, rm
  a CRC32C.new(rd, rn, rm, 0x03, 0b1)
end

#crc32h(rd, rn, rm) ⇒ Object



627
628
629
# File 'lib/aarch64.rb', line 627

def crc32h rd, rn, rm
  a CRC32.new(rd, rn, rm, 0x01, 0b0)
end

#crc32w(rd, rn, rm) ⇒ Object



631
632
633
# File 'lib/aarch64.rb', line 631

def crc32w rd, rn, rm
  a CRC32.new(rd, rn, rm, 0x02, 0b0)
end

#crc32x(rd, rn, rm) ⇒ Object



635
636
637
# File 'lib/aarch64.rb', line 635

def crc32x rd, rn, rm
  a CRC32.new(rd, rn, rm, 0x03, 0b1)
end

#csdbObject



655
656
657
# File 'lib/aarch64.rb', line 655

def csdb
  a CSDB.new
end

#csel(rd, rn, rm, cond) ⇒ Object



659
660
661
# File 'lib/aarch64.rb', line 659

def csel rd, rn, rm, cond
  a CSEL.new(rd, rn, rm, Utils.cond2bin(cond), rd.sf)
end

#cset(rd, cond) ⇒ Object



570
571
572
# File 'lib/aarch64.rb', line 570

def cset rd, cond
  a CSINC.new(rd, WZR, WZR, Utils.cond2bin(cond) ^ 1, rd.sf)
end

#csetm(rd, cond) ⇒ Object



574
575
576
577
# File 'lib/aarch64.rb', line 574

def csetm rd, cond
  reg = rd.zr
  a CSINV.new(rd, reg, reg, Utils.cond2bin(cond) ^ 1, rd.sf)
end

#csinc(rd, rn, rm, cond) ⇒ Object



579
580
581
# File 'lib/aarch64.rb', line 579

def csinc rd, rn, rm, cond
  a CSINC.new(rd, rn, rm, Utils.cond2bin(cond), rd.sf)
end

#csinv(rd, rn, rm, cond) ⇒ Object



587
588
589
# File 'lib/aarch64.rb', line 587

def csinv rd, rn, rm, cond
  a CSINV.new(rd, rn, rm, Utils.cond2bin(cond), rd.sf)
end

#csneg(rd, rn, rm, cond) ⇒ Object



663
664
665
# File 'lib/aarch64.rb', line 663

def csneg rd, rn, rm, cond
  a CSNEG.new(rd, rn, rm, Utils.cond2bin(cond), rd.sf)
end

#dc(dc_op, xt) ⇒ Object



667
668
669
670
# File 'lib/aarch64.rb', line 667

def dc dc_op, xt
  op1, cm, op2 = Utils.dc_op(dc_op)
  sys op1, Names::C7, cm, op2, xt
end

#dcps1(imm = 0) ⇒ Object



672
673
674
# File 'lib/aarch64.rb', line 672

def dcps1 imm = 0
  a DCPS.new(imm, 0x1)
end

#dcps2(imm = 0) ⇒ Object



676
677
678
# File 'lib/aarch64.rb', line 676

def dcps2 imm = 0
  a DCPS.new(imm, 0x2)
end

#dcps3(imm = 0) ⇒ Object



680
681
682
# File 'lib/aarch64.rb', line 680

def dcps3 imm = 0
  a DCPS.new(imm, 0x3)
end

#dghObject



684
685
686
# File 'lib/aarch64.rb', line 684

def dgh
  a DGH.new
end

#dmb(option) ⇒ Object



688
689
690
691
692
693
694
# File 'lib/aarch64.rb', line 688

def dmb option
  if Numeric === option
    a DMB.new(option)
  else
    a DMB.new(Utils.dmb2imm(option))
  end
end

#drpsObject



696
697
698
# File 'lib/aarch64.rb', line 696

def drps
  a DRPS.new
end

#dsb(option) ⇒ Object



700
701
702
703
704
705
706
# File 'lib/aarch64.rb', line 700

def dsb option
  if Numeric === option
    a DSB.new(option)
  else
    a DSB.new(Utils.dmb2imm(option))
  end
end

#dvp(_, xt) ⇒ Object



708
709
710
# File 'lib/aarch64.rb', line 708

def dvp _, xt
  sys 3, Names::C7, Names::C3, 5, xt
end

#eon(d, n, m, option = nil, amount: 0, shift: :lsl) ⇒ Object



712
713
714
715
716
717
718
719
720
# File 'lib/aarch64.rb', line 712

def eon d, n, m, option = nil, amount: 0, shift: :lsl
  if option
    shift = option.name
    amount = option.amount
  end

  shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)
  a EON.new(d, n, m, shift, amount, d.sf)
end

#eor(rd, rn, rm, options = nil, shift: :lsl, amount: 0) ⇒ Object



722
723
724
725
726
727
728
729
730
731
732
733
734
735
# File 'lib/aarch64.rb', line 722

def eor rd, rn, rm, options = nil, shift: :lsl, amount: 0
  if options
    shift = options.name
    amount = options.amount
  end

  if rm.integer?
    encoding = Utils.encode_mask(rm, rd.size)
    a EOR_log_imm.new(rd, rn, encoding.n, encoding.immr, encoding.imms, rd.sf)
  else
    shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)
    a EOR_log_shift.new(rd, rn, rm, shift, amount, rd.sf)
  end
end

#eretObject



737
738
739
# File 'lib/aarch64.rb', line 737

def eret
  a ERET.new
end

#eretaaObject



741
742
743
# File 'lib/aarch64.rb', line 741

def eretaa
  a ERETA.new(0)
end

#eretabObject



745
746
747
# File 'lib/aarch64.rb', line 745

def eretab
  a ERETA.new(1)
end

#esbObject



749
750
751
# File 'lib/aarch64.rb', line 749

def esb
  a ESB.new
end

#extr(rd, rn, rm, lsb) ⇒ Object



753
754
755
# File 'lib/aarch64.rb', line 753

def extr rd, rn, rm, lsb
  a EXTR.new(rd, rn, rm, lsb, rd.sf)
end

#gmi(rd, rn, rm) ⇒ Object



757
758
759
# File 'lib/aarch64.rb', line 757

def gmi rd, rn, rm
  a GMI.new(rd, rn, rm)
end

#hint(imm) ⇒ Object



761
762
763
# File 'lib/aarch64.rb', line 761

def hint imm
  a HINT.new(31, imm)
end

#hlt(imm) ⇒ Object



765
766
767
# File 'lib/aarch64.rb', line 765

def hlt imm
  a HLT.new(imm)
end

#hvc(imm) ⇒ Object



769
770
771
# File 'lib/aarch64.rb', line 769

def hvc imm
  a HVC.new(imm)
end

#ic(op, xt = SP) ⇒ Object



773
774
775
776
# File 'lib/aarch64.rb', line 773

def ic op, xt = SP
  op1, crm, op2 = Utils.ic_op(op)
  sys op1, Names::C7, crm, op2, xt
end

#irg(rd, rn, rm = XZR) ⇒ Object



778
779
780
# File 'lib/aarch64.rb', line 778

def irg rd, rn, rm = XZR
  a IRG.new(rd, rn, rm)
end

#isb(option = 0b1111) ⇒ Object



782
783
784
# File 'lib/aarch64.rb', line 782

def isb option = 0b1111
  a ISB.new(option)
end

#ld64b(rt, rn) ⇒ Object



786
787
788
# File 'lib/aarch64.rb', line 786

def ld64b rt, rn
  a LD64B.new(rt, rn.first)
end

#ldadd(rs, rt, rn) ⇒ Object



790
791
792
# File 'lib/aarch64.rb', line 790

def ldadd rs, rt, rn
  a LDADD.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#ldadda(rs, rt, rn) ⇒ Object



794
795
796
# File 'lib/aarch64.rb', line 794

def ldadda rs, rt, rn
  a LDADD.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#ldaddab(rs, rt, rn) ⇒ Object



806
807
808
# File 'lib/aarch64.rb', line 806

def ldaddab rs, rt, rn
  a LDADDB.new(rs, rt, rn.first, 1, 0)
end

#ldaddah(rs, rt, rn) ⇒ Object



822
823
824
# File 'lib/aarch64.rb', line 822

def ldaddah rs, rt, rn
  a LDADDH.new(rs, rt, rn.first, 1, 0)
end

#ldaddal(rs, rt, rn) ⇒ Object



798
799
800
# File 'lib/aarch64.rb', line 798

def ldaddal rs, rt, rn
  a LDADD.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#ldaddalb(rs, rt, rn) ⇒ Object



810
811
812
# File 'lib/aarch64.rb', line 810

def ldaddalb rs, rt, rn
  a LDADDB.new(rs, rt, rn.first, 1, 1)
end

#ldaddalh(rs, rt, rn) ⇒ Object



826
827
828
# File 'lib/aarch64.rb', line 826

def ldaddalh rs, rt, rn
  a LDADDH.new(rs, rt, rn.first, 1, 1)
end

#ldaddb(rs, rt, rn) ⇒ Object



814
815
816
# File 'lib/aarch64.rb', line 814

def ldaddb rs, rt, rn
  a LDADDB.new(rs, rt, rn.first, 0, 0)
end

#ldaddh(rs, rt, rn) ⇒ Object



830
831
832
# File 'lib/aarch64.rb', line 830

def ldaddh rs, rt, rn
  a LDADDH.new(rs, rt, rn.first, 0, 0)
end

#ldaddl(rs, rt, rn) ⇒ Object



802
803
804
# File 'lib/aarch64.rb', line 802

def ldaddl rs, rt, rn
  a LDADD.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#ldaddlb(rs, rt, rn) ⇒ Object



818
819
820
# File 'lib/aarch64.rb', line 818

def ldaddlb rs, rt, rn
  a LDADDB.new(rs, rt, rn.first, 0, 1)
end

#ldaddlh(rs, rt, rn) ⇒ Object



834
835
836
# File 'lib/aarch64.rb', line 834

def ldaddlh rs, rt, rn
  a LDADDH.new(rs, rt, rn.first, 0, 1)
end

#ldapr(rt, rn) ⇒ Object



838
839
840
# File 'lib/aarch64.rb', line 838

def ldapr rt, rn
  a LDAPR.new(rt, rn.first, rt.opc2)
end

#ldaprb(rt, rn) ⇒ Object



842
843
844
# File 'lib/aarch64.rb', line 842

def ldaprb rt, rn
  a LDAPRB.new(rt, rn.first)
end

#ldaprh(rt, rn) ⇒ Object



846
847
848
# File 'lib/aarch64.rb', line 846

def ldaprh rt, rn
  a LDAPRH.new(rt, rn.first)
end

#ldapur(rt, rn) ⇒ Object



850
851
852
# File 'lib/aarch64.rb', line 850

def ldapur rt, rn
  a LDAPUR_gen.new(rt.opc2, 0b01, rt, rn.first, rn[1] || 0)
end

#ldapurb(rt, rn) ⇒ Object



854
855
856
# File 'lib/aarch64.rb', line 854

def ldapurb rt, rn
  a LDAPUR_gen.new(0b00, 0b01, rt, rn.first, rn[1] || 0)
end

#ldapurh(rt, rn) ⇒ Object



858
859
860
# File 'lib/aarch64.rb', line 858

def ldapurh rt, rn
  a LDAPUR_gen.new(0b01, 0b01, rt, rn.first, rn[1] || 0)
end

#ldapursb(rt, rn) ⇒ Object



862
863
864
# File 'lib/aarch64.rb', line 862

def ldapursb rt, rn
  a LDAPUR_gen.new(0b00, rt.opc, rt, rn.first, rn[1] || 0)
end

#ldapursh(rt, rn) ⇒ Object



866
867
868
# File 'lib/aarch64.rb', line 866

def ldapursh rt, rn
  a LDAPUR_gen.new(0b01, rt.opc, rt, rn.first, rn[1] || 0)
end

#ldapursw(rt, rn) ⇒ Object



870
871
872
# File 'lib/aarch64.rb', line 870

def ldapursw rt, rn
  a LDAPUR_gen.new(0b10, 0b10, rt, rn.first, rn[1] || 0)
end

#ldar(rt, rn) ⇒ Object



874
875
876
# File 'lib/aarch64.rb', line 874

def ldar rt, rn
  a LDAR.new(rt, rn.first, rt.opc2)
end

#ldarb(rt, rn) ⇒ Object



878
879
880
# File 'lib/aarch64.rb', line 878

def ldarb rt, rn
  a LDAR.new(rt, rn.first, 0x00)
end

#ldarh(rt, rn) ⇒ Object



882
883
884
# File 'lib/aarch64.rb', line 882

def ldarh rt, rn
  a LDAR.new(rt, rn.first, 0x01)
end

#ldaxp(rt1, rt2, xn) ⇒ Object



886
887
888
# File 'lib/aarch64.rb', line 886

def ldaxp rt1, rt2, xn
  a LDAXP.new(rt1, rt2, xn.first, rt1.sf)
end

#ldaxr(rt1, xn) ⇒ Object



890
891
892
# File 'lib/aarch64.rb', line 890

def ldaxr rt1, xn
  a LDAXR.new(rt1, xn.first, rt1.opc2)
end

#ldaxrb(rt1, xn) ⇒ Object



894
895
896
# File 'lib/aarch64.rb', line 894

def ldaxrb rt1, xn
  a LDAXR.new(rt1, xn.first, 0b00)
end

#ldaxrh(rt1, xn) ⇒ Object



898
899
900
# File 'lib/aarch64.rb', line 898

def ldaxrh rt1, xn
  a LDAXR.new(rt1, xn.first, 0b01)
end

#ldclr(rs, rt, rn) ⇒ Object



902
903
904
# File 'lib/aarch64.rb', line 902

def ldclr rs, rt, rn
  a LDCLR.new(rs, rt, rn.first, 0, 0, rs.opc2)
end

#ldclra(rs, rt, rn) ⇒ Object



906
907
908
# File 'lib/aarch64.rb', line 906

def ldclra rs, rt, rn
  a LDCLR.new(rs, rt, rn.first, 1, 0, rs.opc2)
end

#ldclrab(rs, rt, rn) ⇒ Object



918
919
920
# File 'lib/aarch64.rb', line 918

def ldclrab rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 1, 0, 0b00)
end

#ldclrah(rs, rt, rn) ⇒ Object



934
935
936
# File 'lib/aarch64.rb', line 934

def ldclrah rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 1, 0, 0b01)
end

#ldclral(rs, rt, rn) ⇒ Object



910
911
912
# File 'lib/aarch64.rb', line 910

def ldclral rs, rt, rn
  a LDCLR.new(rs, rt, rn.first, 1, 1, rs.opc2)
end

#ldclralb(rs, rt, rn) ⇒ Object



922
923
924
# File 'lib/aarch64.rb', line 922

def ldclralb rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 1, 1, 0b00)
end

#ldclralh(rs, rt, rn) ⇒ Object



938
939
940
# File 'lib/aarch64.rb', line 938

def ldclralh rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 1, 1, 0b01)
end

#ldclrb(rs, rt, rn) ⇒ Object



926
927
928
# File 'lib/aarch64.rb', line 926

def ldclrb rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 0, 0, 0b00)
end

#ldclrh(rs, rt, rn) ⇒ Object



942
943
944
# File 'lib/aarch64.rb', line 942

def ldclrh rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 0, 0, 0b01)
end

#ldclrl(rs, rt, rn) ⇒ Object



914
915
916
# File 'lib/aarch64.rb', line 914

def ldclrl rs, rt, rn
  a LDCLR.new(rs, rt, rn.first, 0, 1, rs.opc2)
end

#ldclrlb(rs, rt, rn) ⇒ Object



930
931
932
# File 'lib/aarch64.rb', line 930

def ldclrlb rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 0, 1, 0b00)
end

#ldclrlh(rs, rt, rn) ⇒ Object



946
947
948
# File 'lib/aarch64.rb', line 946

def ldclrlh rs, rt, rn
  a LDCLRB.new(rs, rt, rn.first, 0, 1, 0b01)
end

#ldeor(rs, rt, rn) ⇒ Object



950
951
952
# File 'lib/aarch64.rb', line 950

def ldeor rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 0, rs.opc2)
end

#ldeora(rs, rt, rn) ⇒ Object



954
955
956
# File 'lib/aarch64.rb', line 954

def ldeora rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 0, rs.opc2)
end

#ldeorab(rs, rt, rn) ⇒ Object



966
967
968
# File 'lib/aarch64.rb', line 966

def ldeorab rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 0, 0b00)
end

#ldeorah(rs, rt, rn) ⇒ Object



982
983
984
# File 'lib/aarch64.rb', line 982

def ldeorah rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 0, 0b01)
end

#ldeoral(rs, rt, rn) ⇒ Object



958
959
960
# File 'lib/aarch64.rb', line 958

def ldeoral rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 1, rs.opc2)
end

#ldeoralb(rs, rt, rn) ⇒ Object



970
971
972
# File 'lib/aarch64.rb', line 970

def ldeoralb rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 1, 0b00)
end

#ldeoralh(rs, rt, rn) ⇒ Object



986
987
988
# File 'lib/aarch64.rb', line 986

def ldeoralh rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 1, 1, 0b01)
end

#ldeorb(rs, rt, rn) ⇒ Object



974
975
976
# File 'lib/aarch64.rb', line 974

def ldeorb rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 0, 0b00)
end

#ldeorh(rs, rt, rn) ⇒ Object



990
991
992
# File 'lib/aarch64.rb', line 990

def ldeorh rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 0, 0b01)
end

#ldeorl(rs, rt, rn) ⇒ Object



962
963
964
# File 'lib/aarch64.rb', line 962

def ldeorl rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 1, rs.opc2)
end

#ldeorlb(rs, rt, rn) ⇒ Object



978
979
980
# File 'lib/aarch64.rb', line 978

def ldeorlb rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 1, 0b00)
end

#ldeorlh(rs, rt, rn) ⇒ Object



994
995
996
# File 'lib/aarch64.rb', line 994

def ldeorlh rs, rt, rn
  a LDEOR.new(rs, rt, rn.first, 0, 1, 0b01)
end

#ldg(xt, xn) ⇒ Object



998
999
1000
# File 'lib/aarch64.rb', line 998

def ldg xt, xn
  a LDG.new(xt, xn.first, xn[1] || 0)
end

#ldgm(xt, xn) ⇒ Object



1002
1003
1004
# File 'lib/aarch64.rb', line 1002

def ldgm xt, xn
  a LDGM.new(xt, xn.first)
end

#ldlar(rt, rn) ⇒ Object



1006
1007
1008
# File 'lib/aarch64.rb', line 1006

def ldlar rt, rn
  a LDLAR.new(rt, rn.first, rt.opc2)
end

#ldlarb(rt, rn) ⇒ Object



1010
1011
1012
# File 'lib/aarch64.rb', line 1010

def ldlarb rt, rn
  a LDLAR.new(rt, rn.first, 0b00)
end

#ldlarh(rt, rn) ⇒ Object



1014
1015
1016
# File 'lib/aarch64.rb', line 1014

def ldlarh rt, rn
  a LDLAR.new(rt, rn.first, 0b01)
end

#ldnp(rt1, rt2, rn) ⇒ Object



1018
1019
1020
1021
# File 'lib/aarch64.rb', line 1018

def ldnp rt1, rt2, rn
  div = rt1.size / 8
  a LDNP_gen.new(rt1, rt2, rn.first, (rn[1] || 0) / div, rt1.opc3)
end

#ldp(rt1, rt2, rn, imm = nil) ⇒ Object



1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
# File 'lib/aarch64.rb', line 1023

def ldp rt1, rt2, rn, imm = nil
  opc = rt1.opc3
  div = rt1.size / 8

  if imm
    if imm == :!
      # pre-index
      a LDP_gen.new(rt1, rt2, rn.first, (rn[1] || 0) / div, 0b011, opc)
    else
      # post-index
      a LDP_gen.new(rt1, rt2, rn.first, (imm || 0) / div, 0b001, opc)
    end
  else
    # signed offset
    a LDP_gen.new(rt1, rt2, rn.first, (rn[1] || 0) / div, 0b010, opc)
  end
end

#ldpsw(rt, rt2, rn, imm = nil) ⇒ Object



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
# File 'lib/aarch64.rb', line 1041

def ldpsw rt, rt2, rn, imm = nil
  div = 4

  if imm
    if imm == :!
      # pre-index
      a LDPSW.new(rt, rt2, rn.first, (rn[1] || 0) / div, 0b011)
    else
      # post-index
      a LDPSW.new(rt, rt2, rn.first, (imm || 0) / div, 0b001)
    end
  else
    # signed offset
    a LDPSW.new(rt, rt2, rn.first, (rn[1] || 0) / div, 0b010)
  end
end

#ldr(rt, rn, simm = nil) ⇒ Object



1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/aarch64.rb', line 1058

def ldr rt, rn, simm = nil
  size = rt.opc2

  if simm
    if simm == :!
      a LDR_imm_gen.new(rt, rn.first, (rn[1] || 0), size, 0b11)
    else
      if simm.integer?
        a LDR_imm_gen.new(rt, rn.first, simm, size, 0b01)
      else
        raise
      end
    end
  else
    if rn.is_a?(Array)
      simm = rn[1] || 0
      if simm.integer?
        div = rt.size / 8
        a LDR_imm_unsigned.new(rt, rn.first, simm / div, size)
      else
        rn, rm, option = *rn
        option ||= Shifts::Shift.new(0, 0, :lsl)
        extend = case option.name
                 when :uxtw then 0b010
                 when :lsl  then 0b011
                 when :sxtw then 0b110
                 when :sxtx then 0b111
                 else
                   raise
                 end

        amount = if rt.x?
                   if option.amount == 3
                     1
                   else
                     0
                   end
                 else
                   if option.amount == 2
                     1
                   else
                     0
                   end
                 end

        a LDR_reg_gen.new(rt, rn, rm, size, extend, amount)
      end
    else
      a LDR_lit_gen.new(rt, rn, rt.sf)
    end
  end
end

#ldraa(xt, xn, option = nil) ⇒ Object



1111
1112
1113
1114
1115
# File 'lib/aarch64.rb', line 1111

def ldraa xt, xn, option = nil
  imm = xn[1] || 0
  s = imm < 0 ? 1 : 0
  a LDRA.new(xt, xn.first, imm / 8, 0, option == :! ? 1 : 0, s)
end

#ldrab(xt, xn, option = nil) ⇒ Object



1117
1118
1119
1120
1121
# File 'lib/aarch64.rb', line 1117

def ldrab xt, xn, option = nil
  imm = xn[1] || 0
  s = imm < 0 ? 1 : 0
  a LDRA.new(xt, xn.first, imm / 8, 1, option == :! ? 1 : 0, s)
end

#ldrb(wt, xn, imm = nil) ⇒ Object



1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
# File 'lib/aarch64.rb', line 1123

def ldrb wt, xn, imm = nil
  if imm
    if imm == :!
      a LDRB_imm.new(wt, xn.first, xn[1], 0b11)
    else
      # Post index
      a LDRB_imm.new(wt, xn.first, imm, 0b01)
    end
  else
    xn, imm, option = *xn
    imm ||= 0
    if imm.integer?
      a LDRB_unsigned.new(wt, xn, imm)
    else
      if option
        option_name = option ? option.name : :lsl

        val = case option_name
              when :lsl then 0b011
              when :uxtw then 0b010
              when :sxtw then 0b110
              when :sxtx then 0b111
              end

        a LDRB_reg.new(wt, xn, imm, option.shift? ? 1 : 0, val)
      else
        a LDRB_reg.new(wt, xn, imm, 0, 0b11)
      end
    end
  end
end

#ldrh(wt, xn, imm = nil) ⇒ Object



1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
# File 'lib/aarch64.rb', line 1155

def ldrh wt, xn, imm = nil
  if imm
    if imm == :!
      a LDRH_imm.new(wt, xn.first, xn[1], 0b11)
    else
      # Post index
      a LDRH_imm.new(wt, xn.first, imm, 0b01)
    end
  else
    xn, imm, option = *xn
    imm ||= 0
    if imm.integer?
      a LDRH_unsigned.new(wt, xn, imm)
    else
      if option
        option_name = option ? option.name : :lsl

        val = case option_name
              when :lsl then 0b011
              when :uxtw then 0b010
              when :sxtw then 0b110
              when :sxtx then 0b111
              end

        a LDRH_reg.new(wt, xn, imm, option.shift? ? 1 : 0, val)
      else
        a LDRH_reg.new(wt, xn, imm, 0, 0b11)
      end
    end
  end
end

#ldrsb(wt, xn, imm = nil) ⇒ Object



1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
# File 'lib/aarch64.rb', line 1187

def ldrsb wt, xn, imm = nil
  opc = wt.opc

  if imm
    if imm == :!
      a LDRSB_imm.new(wt, xn.first, xn[1], 0b11, opc)
    else
      # Post index
      a LDRSB_imm.new(wt, xn.first, imm, 0b01, opc)
    end
  else
    xn, imm, option = *xn
    imm ||= 0
    if imm.integer?
      a LDRSB_unsigned.new(wt, xn, imm, opc)
    else
      if option
        option_name = option ? option.name : :lsl

        val = case option_name
              when :uxtw then 0b010
              when :sxtw then 0b110
              when :sxtx then 0b111
              end

        a LDRSB_reg.new(wt, xn, imm, 1, val, opc)
      else
        a LDRSB_reg.new(wt, xn, imm, 0, 0b11, opc)
      end
    end
  end
end

#ldrsh(wt, xn, imm = nil) ⇒ Object



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
# File 'lib/aarch64.rb', line 1220

def ldrsh wt, xn, imm = nil
  opc = wt.opc

  if imm
    if imm == :!
      a LDRSH_imm.new(wt, xn.first, xn[1] || 0, 0b11, opc)
    else
      a LDRSH_imm.new(wt, xn.first, imm, 0b01, opc)
    end
  else
    xn, imm, option = *xn
    imm ||= 0
    if imm.integer?
      a LDRSH_unsigned.new(wt, xn, imm / 2, opc)
    else
      if option
        option_name = option ? option.name : :lsl

        val = case option_name
              when :uxtw then 0b010
              when :sxtw then 0b110
              when :sxtx then 0b111
              end

        a LDRSH_reg.new(wt, xn, imm, 1, val, opc)
      else
        a LDRSH_reg.new(wt, xn, imm, 0, 0b11, opc)
      end
    end
  end
end

#ldrsw(xt, xn, imm = nil) ⇒ Object



1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
# File 'lib/aarch64.rb', line 1252

def ldrsw xt, xn, imm = nil
  if imm
    if imm == :!
      a LDRSW_imm.new(xt, xn.first, xn[1] || 0, 0b11)
    else
      a LDRSW_imm.new(xt, xn.first, imm, 0b01)
    end
  else
    if xn.is_a?(Array)
      xn, imm, option = *xn
      imm ||= 0
      if imm.integer?
        a LDRSW_unsigned.new(xt, xn, imm / 4)
      else
        if option
          option_name = option ? option.name : :lsl

          val = case option_name
                when :uxtw then 0b010
                when :lsl  then 0b011
                when :sxtw then 0b110
                when :sxtx then 0b111
                end

          a LDRSW_reg.new(xt, xn, imm, option.amount / 2, val)
        else
          a LDRSW_reg.new(xt, xn, imm, 0, 0b11)
        end
      end
    else
      a LDRSW_lit.new(xt, xn)
    end
  end
end

#ldset(rs, rt, rn) ⇒ Object



1287
1288
1289
# File 'lib/aarch64.rb', line 1287

def ldset rs, rt, rn
  a LDSET.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#ldseta(rs, rt, rn) ⇒ Object



1291
1292
1293
# File 'lib/aarch64.rb', line 1291

def ldseta rs, rt, rn
  a LDSET.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#ldsetab(rs, rt, rn) ⇒ Object



1307
1308
1309
# File 'lib/aarch64.rb', line 1307

def ldsetab rs, rt, rn
  a LDSETB.new(rs, rt, rn.first, 1, 0)
end

#ldsetah(rs, rt, rn) ⇒ Object



1323
1324
1325
# File 'lib/aarch64.rb', line 1323

def ldsetah rs, rt, rn
  a LDSETH.new(rs, rt, rn.first, 1, 0)
end

#ldsetal(rs, rt, rn) ⇒ Object



1295
1296
1297
# File 'lib/aarch64.rb', line 1295

def ldsetal rs, rt, rn
  a LDSET.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#ldsetalb(rs, rt, rn) ⇒ Object



1311
1312
1313
# File 'lib/aarch64.rb', line 1311

def ldsetalb rs, rt, rn
  a LDSETB.new(rs, rt, rn.first, 1, 1)
end

#ldsetalh(rs, rt, rn) ⇒ Object



1327
1328
1329
# File 'lib/aarch64.rb', line 1327

def ldsetalh rs, rt, rn
  a LDSETH.new(rs, rt, rn.first, 1, 1)
end

#ldsetb(rs, rt, rn) ⇒ Object



1303
1304
1305
# File 'lib/aarch64.rb', line 1303

def ldsetb rs, rt, rn
  a LDSETB.new(rs, rt, rn.first, 0, 0)
end

#ldseth(rs, rt, rn) ⇒ Object



1319
1320
1321
# File 'lib/aarch64.rb', line 1319

def ldseth rs, rt, rn
  a LDSETH.new(rs, rt, rn.first, 0, 0)
end

#ldsetl(rs, rt, rn) ⇒ Object



1299
1300
1301
# File 'lib/aarch64.rb', line 1299

def ldsetl rs, rt, rn
  a LDSET.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#ldsetlb(rs, rt, rn) ⇒ Object



1315
1316
1317
# File 'lib/aarch64.rb', line 1315

def ldsetlb rs, rt, rn
  a LDSETB.new(rs, rt, rn.first, 0, 1)
end

#ldsetlh(rs, rt, rn) ⇒ Object



1331
1332
1333
# File 'lib/aarch64.rb', line 1331

def ldsetlh rs, rt, rn
  a LDSETH.new(rs, rt, rn.first, 0, 1)
end

#ldsmax(rs, rt, rn) ⇒ Object



1335
1336
1337
# File 'lib/aarch64.rb', line 1335

def ldsmax rs, rt, rn
  a LDSMAX.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#ldsmaxa(rs, rt, rn) ⇒ Object



1339
1340
1341
# File 'lib/aarch64.rb', line 1339

def ldsmaxa rs, rt, rn
  a LDSMAX.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#ldsmaxab(rs, rt, rn) ⇒ Object



1351
1352
1353
# File 'lib/aarch64.rb', line 1351

def ldsmaxab rs, rt, rn
  a LDSMAXB.new(rs, rt, rn.first, 1, 0)
end

#ldsmaxah(rs, rt, rn) ⇒ Object



1367
1368
1369
# File 'lib/aarch64.rb', line 1367

def ldsmaxah rs, rt, rn
  a LDSMAXH.new(rs, rt, rn.first, 1, 0)
end

#ldsmaxal(rs, rt, rn) ⇒ Object



1343
1344
1345
# File 'lib/aarch64.rb', line 1343

def ldsmaxal rs, rt, rn
  a LDSMAX.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#ldsmaxalb(rs, rt, rn) ⇒ Object



1355
1356
1357
# File 'lib/aarch64.rb', line 1355

def ldsmaxalb rs, rt, rn
  a LDSMAXB.new(rs, rt, rn.first, 1, 1)
end

#ldsmaxalh(rs, rt, rn) ⇒ Object



1371
1372
1373
# File 'lib/aarch64.rb', line 1371

def ldsmaxalh rs, rt, rn
  a LDSMAXH.new(rs, rt, rn.first, 1, 1)
end

#ldsmaxb(rs, rt, rn) ⇒ Object



1359
1360
1361
# File 'lib/aarch64.rb', line 1359

def ldsmaxb rs, rt, rn
  a LDSMAXB.new(rs, rt, rn.first, 0, 0)
end

#ldsmaxh(rs, rt, rn) ⇒ Object



1375
1376
1377
# File 'lib/aarch64.rb', line 1375

def ldsmaxh rs, rt, rn
  a LDSMAXH.new(rs, rt, rn.first, 0, 0)
end

#ldsmaxl(rs, rt, rn) ⇒ Object



1347
1348
1349
# File 'lib/aarch64.rb', line 1347

def ldsmaxl rs, rt, rn
  a LDSMAX.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#ldsmaxlb(rs, rt, rn) ⇒ Object



1363
1364
1365
# File 'lib/aarch64.rb', line 1363

def ldsmaxlb rs, rt, rn
  a LDSMAXB.new(rs, rt, rn.first, 0, 1)
end

#ldsmaxlh(rs, rt, rn) ⇒ Object



1379
1380
1381
# File 'lib/aarch64.rb', line 1379

def ldsmaxlh rs, rt, rn
  a LDSMAXH.new(rs, rt, rn.first, 0, 1)
end

#ldsmin(rs, rt, rn) ⇒ Object



1383
1384
1385
# File 'lib/aarch64.rb', line 1383

def ldsmin rs, rt, rn
  a LDSMIN.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#ldsmina(rs, rt, rn) ⇒ Object



1387
1388
1389
# File 'lib/aarch64.rb', line 1387

def ldsmina rs, rt, rn
  a LDSMIN.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#ldsminab(rs, rt, rn) ⇒ Object



1403
1404
1405
# File 'lib/aarch64.rb', line 1403

def ldsminab rs, rt, rn
  a LDSMINB.new(rs, rt, rn.first, 1, 0)
end

#ldsminah(rs, rt, rn) ⇒ Object



1419
1420
1421
# File 'lib/aarch64.rb', line 1419

def ldsminah rs, rt, rn
  a LDSMINH.new(rs, rt, rn.first, 1, 0)
end

#ldsminal(rs, rt, rn) ⇒ Object



1391
1392
1393
# File 'lib/aarch64.rb', line 1391

def ldsminal rs, rt, rn
  a LDSMIN.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#ldsminalb(rs, rt, rn) ⇒ Object



1407
1408
1409
# File 'lib/aarch64.rb', line 1407

def ldsminalb rs, rt, rn
  a LDSMINB.new(rs, rt, rn.first, 1, 1)
end

#ldsminalh(rs, rt, rn) ⇒ Object



1423
1424
1425
# File 'lib/aarch64.rb', line 1423

def ldsminalh rs, rt, rn
  a LDSMINH.new(rs, rt, rn.first, 1, 1)
end

#ldsminb(rs, rt, rn) ⇒ Object



1399
1400
1401
# File 'lib/aarch64.rb', line 1399

def ldsminb rs, rt, rn
  a LDSMINB.new(rs, rt, rn.first, 0, 0)
end

#ldsminh(rs, rt, rn) ⇒ Object



1415
1416
1417
# File 'lib/aarch64.rb', line 1415

def ldsminh rs, rt, rn
  a LDSMINH.new(rs, rt, rn.first, 0, 0)
end

#ldsminl(rs, rt, rn) ⇒ Object



1395
1396
1397
# File 'lib/aarch64.rb', line 1395

def ldsminl rs, rt, rn
  a LDSMIN.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#ldsminlb(rs, rt, rn) ⇒ Object



1411
1412
1413
# File 'lib/aarch64.rb', line 1411

def ldsminlb rs, rt, rn
  a LDSMINB.new(rs, rt, rn.first, 0, 1)
end

#ldsminlh(rs, rt, rn) ⇒ Object



1427
1428
1429
# File 'lib/aarch64.rb', line 1427

def ldsminlh rs, rt, rn
  a LDSMINH.new(rs, rt, rn.first, 0, 1)
end

#ldtr(rt, rn) ⇒ Object



1431
1432
1433
# File 'lib/aarch64.rb', line 1431

def ldtr rt, rn
  a LDTR.new(rt, rn.first, rn[1] || 0, rt.opc2)
end

#ldtrb(rt, rn) ⇒ Object



1435
1436
1437
# File 'lib/aarch64.rb', line 1435

def ldtrb rt, rn
  a LDTRB.new(rt, rn.first, rn[1] || 0)
end

#ldtrh(rt, rn) ⇒ Object



1439
1440
1441
# File 'lib/aarch64.rb', line 1439

def ldtrh rt, rn
  a LDTRH.new(rt, rn.first, rn[1] || 0)
end

#ldtrsb(rt, rn) ⇒ Object



1443
1444
1445
# File 'lib/aarch64.rb', line 1443

def ldtrsb rt, rn
  a LDTRSB.new(rt, rn.first, rn[1] || 0, rt.opc)
end

#ldtrsh(rt, rn) ⇒ Object



1447
1448
1449
# File 'lib/aarch64.rb', line 1447

def ldtrsh rt, rn
  a LDTRSH.new(rt, rn.first, rn[1] || 0, rt.opc)
end

#ldtrsw(rt, rn) ⇒ Object



1451
1452
1453
# File 'lib/aarch64.rb', line 1451

def ldtrsw rt, rn
  a LDTRSW.new(rt, rn.first, rn[1] || 0)
end

#ldumax(rs, rt, rn) ⇒ Object



1455
1456
1457
# File 'lib/aarch64.rb', line 1455

def ldumax rs, rt, rn
  a LDUMAX.new(rs, rt, rn.first, rt.opc2, 0, 0)
end

#ldumaxa(rs, rt, rn) ⇒ Object



1459
1460
1461
# File 'lib/aarch64.rb', line 1459

def ldumaxa rs, rt, rn
  a LDUMAX.new(rs, rt, rn.first, rt.opc2, 1, 0)
end

#ldumaxab(rs, rt, rn) ⇒ Object



1471
1472
1473
# File 'lib/aarch64.rb', line 1471

def ldumaxab rs, rt, rn
  a LDUMAXB.new(rs, rt, rn.first, 1, 0)
end

#ldumaxah(rs, rt, rn) ⇒ Object



1487
1488
1489
# File 'lib/aarch64.rb', line 1487

def ldumaxah rs, rt, rn
  a LDUMAXH.new(rs, rt, rn.first, 1, 0)
end

#ldumaxal(rs, rt, rn) ⇒ Object



1463
1464
1465
# File 'lib/aarch64.rb', line 1463

def ldumaxal rs, rt, rn
  a LDUMAX.new(rs, rt, rn.first, rt.opc2, 1, 1)
end

#ldumaxalb(rs, rt, rn) ⇒ Object



1475
1476
1477
# File 'lib/aarch64.rb', line 1475

def ldumaxalb rs, rt, rn
  a LDUMAXB.new(rs, rt, rn.first, 1, 1)
end

#ldumaxalh(rs, rt, rn) ⇒ Object



1491
1492
1493
# File 'lib/aarch64.rb', line 1491

def ldumaxalh rs, rt, rn
  a LDUMAXH.new(rs, rt, rn.first, 1, 1)
end

#ldumaxb(rs, rt, rn) ⇒ Object



1479
1480
1481
# File 'lib/aarch64.rb', line 1479

def ldumaxb rs, rt, rn
  a LDUMAXB.new(rs, rt, rn.first, 0, 0)
end

#ldumaxh(rs, rt, rn) ⇒ Object



1495
1496
1497
# File 'lib/aarch64.rb', line 1495

def ldumaxh rs, rt, rn
  a LDUMAXH.new(rs, rt, rn.first, 0, 0)
end

#ldumaxl(rs, rt, rn) ⇒ Object



1467
1468
1469
# File 'lib/aarch64.rb', line 1467

def ldumaxl rs, rt, rn
  a LDUMAX.new(rs, rt, rn.first, rt.opc2, 0, 1)
end

#ldumaxlb(rs, rt, rn) ⇒ Object



1483
1484
1485
# File 'lib/aarch64.rb', line 1483

def ldumaxlb rs, rt, rn
  a LDUMAXB.new(rs, rt, rn.first, 0, 1)
end

#ldumaxlh(rs, rt, rn) ⇒ Object



1499
1500
1501
# File 'lib/aarch64.rb', line 1499

def ldumaxlh rs, rt, rn
  a LDUMAXH.new(rs, rt, rn.first, 0, 1)
end

#ldumin(rs, rt, rn) ⇒ Object



1503
1504
1505
# File 'lib/aarch64.rb', line 1503

def ldumin rs, rt, rn
  a LDUMIN.new(rs, rt, rn.first, rs.sizeb, 0, 0)
end

#ldumina(rs, rt, rn) ⇒ Object



1507
1508
1509
# File 'lib/aarch64.rb', line 1507

def ldumina rs, rt, rn
  a LDUMIN.new(rs, rt, rn.first, rs.sizeb, 1, 0)
end

#lduminab(rs, rt, rn) ⇒ Object



1519
1520
1521
# File 'lib/aarch64.rb', line 1519

def lduminab rs, rt, rn
  a LDUMINB.new(rs, rt, rn.first, 1, 0)
end

#lduminah(rs, rt, rn) ⇒ Object



1535
1536
1537
# File 'lib/aarch64.rb', line 1535

def lduminah rs, rt, rn
  a LDUMINH.new(rs, rt, rn.first, 1, 0)
end

#lduminal(rs, rt, rn) ⇒ Object



1511
1512
1513
# File 'lib/aarch64.rb', line 1511

def lduminal rs, rt, rn
  a LDUMIN.new(rs, rt, rn.first, rs.sizeb, 1, 1)
end

#lduminalb(rs, rt, rn) ⇒ Object



1523
1524
1525
# File 'lib/aarch64.rb', line 1523

def lduminalb rs, rt, rn
  a LDUMINB.new(rs, rt, rn.first, 1, 1)
end

#lduminalh(rs, rt, rn) ⇒ Object



1539
1540
1541
# File 'lib/aarch64.rb', line 1539

def lduminalh rs, rt, rn
  a LDUMINH.new(rs, rt, rn.first, 1, 1)
end

#lduminb(rs, rt, rn) ⇒ Object



1527
1528
1529
# File 'lib/aarch64.rb', line 1527

def lduminb rs, rt, rn
  a LDUMINB.new(rs, rt, rn.first, 0, 0)
end

#lduminh(rs, rt, rn) ⇒ Object



1543
1544
1545
# File 'lib/aarch64.rb', line 1543

def lduminh rs, rt, rn
  a LDUMINH.new(rs, rt, rn.first, 0, 0)
end

#lduminl(rs, rt, rn) ⇒ Object



1515
1516
1517
# File 'lib/aarch64.rb', line 1515

def lduminl rs, rt, rn
  a LDUMIN.new(rs, rt, rn.first, rs.sizeb, 0, 1)
end

#lduminlb(rs, rt, rn) ⇒ Object



1531
1532
1533
# File 'lib/aarch64.rb', line 1531

def lduminlb rs, rt, rn
  a LDUMINB.new(rs, rt, rn.first, 0, 1)
end

#lduminlh(rs, rt, rn) ⇒ Object



1547
1548
1549
# File 'lib/aarch64.rb', line 1547

def lduminlh rs, rt, rn
  a LDUMINH.new(rs, rt, rn.first, 0, 1)
end

#ldur(rt, rn) ⇒ Object



1567
1568
1569
# File 'lib/aarch64.rb', line 1567

def ldur rt, rn
  a LDUR_gen.new(rt, rn.first, rn[1] || 0, rt.opc2)
end

#ldurb(rt, rn) ⇒ Object



1571
1572
1573
# File 'lib/aarch64.rb', line 1571

def ldurb rt, rn
  a LDUR_gen.new(rt, rn.first, rn[1] || 0, 0b00)
end

#ldurh(rt, rn) ⇒ Object



1575
1576
1577
# File 'lib/aarch64.rb', line 1575

def ldurh rt, rn
  a LDUR_gen.new(rt, rn.first, rn[1] || 0, 0b01)
end

#ldursb(rt, rn) ⇒ Object



1551
1552
1553
# File 'lib/aarch64.rb', line 1551

def ldursb rt, rn
  a LDURSB.new(rt, rn.first, rn[1] || 0, rt.opc)
end

#ldursh(rt, rn) ⇒ Object



1555
1556
1557
# File 'lib/aarch64.rb', line 1555

def ldursh rt, rn
  a LDURSH.new(rt, rn.first, rn[1] || 0, rt.opc)
end

#ldursw(rt, rn) ⇒ Object



1559
1560
1561
# File 'lib/aarch64.rb', line 1559

def ldursw rt, rn
  a LDURSW.new(rt, rn.first, rn[1] || 0)
end

#ldxp(rt, rt2, rn) ⇒ Object



1563
1564
1565
# File 'lib/aarch64.rb', line 1563

def ldxp rt, rt2, rn
  a LDXP.new(rt, rt2, rn.first, rt.sf)
end

#ldxr(rt, rn) ⇒ Object



1579
1580
1581
# File 'lib/aarch64.rb', line 1579

def ldxr rt, rn
  a LDXR.new(rt, rn.first, rt.opc2)
end

#ldxrb(rt, rn) ⇒ Object



1583
1584
1585
# File 'lib/aarch64.rb', line 1583

def ldxrb rt, rn
  a LDXR.new(rt, rn.first, 0b00)
end

#ldxrh(rt, rn) ⇒ Object



1587
1588
1589
# File 'lib/aarch64.rb', line 1587

def ldxrh rt, rn
  a LDXR.new(rt, rn.first, 0b01)
end

#lsl(rd, rn, rm) ⇒ Object



1591
1592
1593
1594
1595
1596
1597
# File 'lib/aarch64.rb', line 1591

def lsl rd, rn, rm
  if rm.integer?
    ubfm rd, rn, -rm % rd.size, (rd.size - 1) - rm
  else
    lslv rd, rn, rm
  end
end

#lslv(rd, rn, rm) ⇒ Object



1599
1600
1601
# File 'lib/aarch64.rb', line 1599

def lslv rd, rn, rm
  a LSLV.new(rd, rn, rm, rd.sf)
end

#lsr(rd, rn, rm) ⇒ Object



1603
1604
1605
1606
1607
1608
1609
# File 'lib/aarch64.rb', line 1603

def lsr rd, rn, rm
  if rm.integer?
    ubfm rd, rn, rm, rd.size - 1
  else
    lsrv rd, rn, rm
  end
end

#lsrv(rd, rn, rm) ⇒ Object



1611
1612
1613
# File 'lib/aarch64.rb', line 1611

def lsrv rd, rn, rm
  a LSRV.new(rd, rn, rm, rd.sf)
end

#madd(rd, rn, rm, ra) ⇒ Object



1615
1616
1617
# File 'lib/aarch64.rb', line 1615

def madd rd, rn, rm, ra
  a MADD.new(rd, rn, rm, ra, rd.sf)
end

#make_label(name) ⇒ Object

Makes a new label with name. Place the label using the put_label method.



159
160
161
# File 'lib/aarch64.rb', line 159

def make_label name
  Label.new name
end

#mneg(rd, rn, rm) ⇒ Object



1619
1620
1621
# File 'lib/aarch64.rb', line 1619

def mneg rd, rn, rm
  msub rd, rn, rm, rd.zr
end

#mov(rd, rm) ⇒ Object



1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
# File 'lib/aarch64.rb', line 1623

def mov rd, rm
  if rm.integer?
    if rm < 0
      rm = ~rm
      if rm < 65536 || rm % 65536 == 0
        movn(rd, rm)
      else
        orr(rd, rd.zr, ~rm)
      end
    else
      if rm < 65536 || rm % 65536 == 0
        movz(rd, rm)
      else
        orr(rd, rd.zr, rm)
      end
    end
  else
    if rd.sp? || rm.sp?
      add rd, rm, 0
    else
      orr(rd, rd.zr, rm)
    end
  end
end

#movk(reg, imm, option = nil, lsl: 0) ⇒ Object



1670
1671
1672
1673
# File 'lib/aarch64.rb', line 1670

def movk reg, imm, option = nil, lsl: 0
  lsl = option.amount if option
  a MOVK.new(reg, imm, lsl / 16, reg.sf)
end

#movn(rd, imm, option = nil, lsl: 0) ⇒ Object



1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
# File 'lib/aarch64.rb', line 1648

def movn rd, imm, option = nil, lsl: 0
  lsl = option.amount if option

  lsl /= 16
  while imm > 65535
    lsl += 1
    imm >>= 16
  end
  a MOVN.new(rd, imm, lsl, rd.sf)
end

#movz(reg, imm, option = nil, lsl: 0) ⇒ Object



1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
# File 'lib/aarch64.rb', line 1659

def movz reg, imm, option = nil, lsl: 0
  lsl = option.amount if option

  lsl /= 16
  while imm > 65535
    lsl += 1
    imm >>= 16
  end
  a MOVZ.new(reg, imm, lsl, reg.sf)
end

#mrs(rt, reg) ⇒ Object



1675
1676
1677
# File 'lib/aarch64.rb', line 1675

def mrs rt, reg
  a MRS.new(reg.op0, reg.op1, reg.CRn, reg.CRm, reg.op2, rt)
end

#msr(reg, rt) ⇒ Object



1679
1680
1681
1682
1683
1684
1685
# File 'lib/aarch64.rb', line 1679

def msr reg, rt
  if rt.integer?
    raise NotImplementedError
  else
    a MSR_reg.new(reg.op0, reg.op1, reg.CRn, reg.CRm, reg.op2, rt)
  end
end

#msub(rd, rn, rm, ra) ⇒ Object



1687
1688
1689
# File 'lib/aarch64.rb', line 1687

def msub rd, rn, rm, ra
  a MSUB.new(rd, rn, rm, ra, rd.sf)
end

#mul(rd, rn, rm) ⇒ Object



1691
1692
1693
# File 'lib/aarch64.rb', line 1691

def mul rd, rn, rm
  madd rd, rn, rm, rd.zr
end

#mvn(rd, rm, option = nil, shift: :lsl, amount: 0) ⇒ Object



1695
1696
1697
# File 'lib/aarch64.rb', line 1695

def mvn rd, rm, option = nil, shift: :lsl, amount: 0
  orn rd, rd.zr, rm, option, shift: shift, amount: amount
end

#neg(rd, rm, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl) ⇒ Object



1699
1700
1701
# File 'lib/aarch64.rb', line 1699

def neg rd, rm, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl
  sub rd, rd.zr, rm, option, extend: extend, amount: amount, lsl: lsl, shift: shift
end

#negs(rd, rm, option = nil, shift: :lsl, amount: 0) ⇒ Object



1703
1704
1705
# File 'lib/aarch64.rb', line 1703

def negs rd, rm, option = nil, shift: :lsl, amount: 0
  subs rd, rd.zr, rm, option, shift: shift, amount: amount
end

#ngc(rd, rm) ⇒ Object



1707
1708
1709
# File 'lib/aarch64.rb', line 1707

def ngc rd, rm
  sbc rd, rd.zr, rm
end

#ngcs(rd, rm) ⇒ Object



1711
1712
1713
# File 'lib/aarch64.rb', line 1711

def ngcs rd, rm
  sbcs rd, rd.zr, rm
end

#nopObject



1715
1716
1717
# File 'lib/aarch64.rb', line 1715

def nop
  a NOP.new
end

#orn(rd, rn, rm, option = nil, shift: :lsl, amount: 0) ⇒ Object



1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
# File 'lib/aarch64.rb', line 1719

def orn rd, rn, rm, option = nil, shift: :lsl, amount: 0
  if option
    shift = option.name
    amount = option.amount
  end

  shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)

  a ORN_log_shift.new(rd, rn, rm, shift, amount, rd.sf)
end

#orr(rd, rn, rm, option = nil, shift: :lsl, amount: 0) ⇒ Object



1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
# File 'lib/aarch64.rb', line 1730

def orr rd, rn, rm, option = nil, shift: :lsl, amount: 0
  if rm.integer?
    encoding = Utils.encode_mask(rm, rd.size)
    a ORR_log_imm.new(rd, rn, encoding.n, encoding.immr, encoding.imms, rd.sf)
  else
    if option
      shift = option.name
      amount = option.amount
    end

    shift = [:lsl, :lsr, :asr, :ror].index(shift) || raise(NotImplementedError)

    a ORR_log_shift.new(rd, rn, rm, shift, amount, rd.sf)
  end
end

#pacda(xd, xn) ⇒ Object



1746
1747
1748
# File 'lib/aarch64.rb', line 1746

def pacda xd, xn
  a PACDA.new(xd, xn, 0)
end

#pacdb(xd, xn) ⇒ Object



1754
1755
1756
# File 'lib/aarch64.rb', line 1754

def pacdb xd, xn
  a PACDB.new(xd, xn, 0)
end

#pacdza(xd) ⇒ Object



1750
1751
1752
# File 'lib/aarch64.rb', line 1750

def pacdza xd
  a PACDA.new(xd, xd.zr, 1)
end

#pacdzb(xd) ⇒ Object



1758
1759
1760
# File 'lib/aarch64.rb', line 1758

def pacdzb xd
  a PACDB.new(xd, xd.zr, 1)
end

#pacga(xd, xn, xm) ⇒ Object



1762
1763
1764
# File 'lib/aarch64.rb', line 1762

def pacga xd, xn, xm
  a PACGA.new(xd, xn, xm)
end

#pacia(xd, xn) ⇒ Object



1766
1767
1768
# File 'lib/aarch64.rb', line 1766

def pacia xd, xn
  a PACIA.new(xd, xn, 0)
end

#pacia1716Object



1774
1775
1776
# File 'lib/aarch64.rb', line 1774

def pacia1716
  a PACIA2.new(0b0001, 0b000)
end

#paciaspObject



1778
1779
1780
# File 'lib/aarch64.rb', line 1778

def paciasp
  a PACIA2.new(0b0011, 0b001)
end

#paciazObject



1782
1783
1784
# File 'lib/aarch64.rb', line 1782

def paciaz
  a PACIA2.new(0b0011, 0b000)
end

#pacib(xd, xn) ⇒ Object



1786
1787
1788
# File 'lib/aarch64.rb', line 1786

def pacib xd, xn
  a PACIB.new(xd, xn, 0)
end

#pacib1716Object



1794
1795
1796
# File 'lib/aarch64.rb', line 1794

def pacib1716
  a PACIA2.new(0b0001, 0b010)
end

#pacibspObject



1798
1799
1800
# File 'lib/aarch64.rb', line 1798

def pacibsp
  a PACIA2.new(0b0011, 0b011)
end

#pacibzObject



1802
1803
1804
# File 'lib/aarch64.rb', line 1802

def pacibz
  a PACIA2.new(0b0011, 0b010)
end

#paciza(xd) ⇒ Object



1770
1771
1772
# File 'lib/aarch64.rb', line 1770

def paciza xd
  a PACIA.new(xd, xd.zr, 1)
end

#pacizb(xd) ⇒ Object



1790
1791
1792
# File 'lib/aarch64.rb', line 1790

def pacizb xd
  a PACIB.new(xd, xd.zr, 1)
end

#pretty(&block) ⇒ Object

Creates a DSL object so you can write prettier assembly. For example:

asm = AArch64::Assembler.new
asm.pretty do
  asm.movz x0, 42
  asm.ret
end


153
154
155
# File 'lib/aarch64.rb', line 153

def pretty &block
  DSL.new.instance_eval(&block)
end

#prfm(rt, xn) ⇒ Object



1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
# File 'lib/aarch64.rb', line 1806

def prfm rt, xn
  if rt.is_a?(Symbol)
    rt = Utils.prfop(rt)
  end

  if xn.is_a?(Array)
    xn, rm, option = *xn
    rm ||= 0
    if rm.integer?
      a PRFM_imm.new(rt, xn, rm / 8)
    else
      shift = case option.name
              when :uxtw then 0b010
              when :lsl  then 0b011
              when :sxtw then 0b110
              when :sxtx then 0b111
              else
                raise
              end
      a PRFM_reg.new(rt, xn, rm, shift, option.amount / 3)
    end
  else
    a PRFM_lit.new(rt, xn)
  end
end

#prfum(rt, rn) ⇒ Object



1832
1833
1834
1835
1836
1837
# File 'lib/aarch64.rb', line 1832

def prfum rt, rn
  if rt.is_a?(Symbol)
    rt = Utils.prfop(rt)
  end
  a PRFUM.new(rt, rn.first, rn[1] || 0)
end

#psb(_) ⇒ Object



1839
1840
1841
# File 'lib/aarch64.rb', line 1839

def psb _
  a PSB.new
end

#pssbbObject



1843
1844
1845
# File 'lib/aarch64.rb', line 1843

def pssbb
  dsb 4
end

#put_label(label) ⇒ Object

Puts the label at the current position. Labels can only be placed once.



164
165
166
# File 'lib/aarch64.rb', line 164

def put_label label
  label.set_offset @insns.length
end

#rbit(rd, rn) ⇒ Object



1847
1848
1849
# File 'lib/aarch64.rb', line 1847

def rbit rd, rn
  a RBIT_int.new(rd, rn, rd.sf)
end

#ret(reg = X30) ⇒ Object



1851
1852
1853
# File 'lib/aarch64.rb', line 1851

def ret reg = X30
  a RET.new(reg)
end

#retaaObject



1855
1856
1857
# File 'lib/aarch64.rb', line 1855

def retaa
  a RETA.new(0)
end

#retabObject



1859
1860
1861
# File 'lib/aarch64.rb', line 1859

def retab
  a RETA.new(1)
end

#rev(rd, rn) ⇒ Object Also known as: rev64



1863
1864
1865
# File 'lib/aarch64.rb', line 1863

def rev rd, rn
  a REV.new(rd, rn, rd.sf, rd.opc2)
end

#rev16(rd, rn) ⇒ Object



1867
1868
1869
# File 'lib/aarch64.rb', line 1867

def rev16 rd, rn
  a REV.new(rd, rn, rd.sf, 0b01)
end

#rev32(rd, rn) ⇒ Object



1871
1872
1873
# File 'lib/aarch64.rb', line 1871

def rev32 rd, rn
  a REV.new(rd, rn, rd.sf, 0b10)
end

#rmif(rn, shift, mask) ⇒ Object



1877
1878
1879
# File 'lib/aarch64.rb', line 1877

def rmif rn, shift, mask
  a RMIF.new(rn, shift, mask)
end

#ror(rd, rs, shift) ⇒ Object



1881
1882
1883
1884
1885
1886
1887
# File 'lib/aarch64.rb', line 1881

def ror rd, rs, shift
  if shift.integer?
    extr rd, rs, rs, shift
  else
    rorv rd, rs, shift
  end
end

#rorv(rd, rn, rm) ⇒ Object



1889
1890
1891
# File 'lib/aarch64.rb', line 1889

def rorv rd, rn, rm
  a RORV.new(rd, rn, rm, rd.sf)
end

#sbObject



1893
1894
1895
# File 'lib/aarch64.rb', line 1893

def sb
  a SB.new
end

#sbc(rd, rn, rm) ⇒ Object



1897
1898
1899
# File 'lib/aarch64.rb', line 1897

def sbc rd, rn, rm
  a SBC.new(rd, rn, rm, rd.sf)
end

#sbcs(rd, rn, rm) ⇒ Object



1901
1902
1903
# File 'lib/aarch64.rb', line 1901

def sbcs rd, rn, rm
  a SBCS.new(rd, rn, rm, rd.sf)
end

#sbfiz(rd, rn, lsb, width) ⇒ Object



1905
1906
1907
# File 'lib/aarch64.rb', line 1905

def sbfiz rd, rn, lsb, width
  sbfm rd, rn, -lsb % rd.size, width - 1
end

#sbfm(d, n, immr, imms) ⇒ Object



1909
1910
1911
# File 'lib/aarch64.rb', line 1909

def sbfm d, n, immr, imms
  a SBFM.new(d, n, immr, imms, d.sf)
end

#sbfx(rd, rn, lsb, width) ⇒ Object



1913
1914
1915
# File 'lib/aarch64.rb', line 1913

def sbfx rd, rn, lsb, width
  sbfm rd, rn, lsb, lsb + width - 1
end

#sdiv(rd, rn, rm) ⇒ Object



1917
1918
1919
# File 'lib/aarch64.rb', line 1917

def sdiv rd, rn, rm
  a SDIV.new(rd, rn, rm, rd.sf)
end

#setf16(rn) ⇒ Object



1925
1926
1927
# File 'lib/aarch64.rb', line 1925

def setf16 rn
  a SETF.new(rn, 1)
end

#setf8(rn) ⇒ Object



1921
1922
1923
# File 'lib/aarch64.rb', line 1921

def setf8 rn
  a SETF.new(rn, 0)
end

#sevObject



1929
1930
1931
# File 'lib/aarch64.rb', line 1929

def sev
  a SEV.new
end

#sevlObject



1933
1934
1935
# File 'lib/aarch64.rb', line 1933

def sevl
  a SEVL.new
end

#smaddl(xd, wn, wm, xa) ⇒ Object



1937
1938
1939
# File 'lib/aarch64.rb', line 1937

def smaddl xd, wn, wm, xa
  a SMADDL.new(xd, wn, wm, xa)
end

#smc(imm) ⇒ Object



1941
1942
1943
# File 'lib/aarch64.rb', line 1941

def smc imm
  a SMC.new(imm)
end

#smnegl(rd, rn, rm) ⇒ Object



1945
1946
1947
# File 'lib/aarch64.rb', line 1945

def smnegl rd, rn, rm
  smsubl rd, rn, rm, XZR
end

#smsubl(rd, rn, rm, ra) ⇒ Object



1949
1950
1951
# File 'lib/aarch64.rb', line 1949

def smsubl rd, rn, rm, ra
  a SMSUBL.new(rd, rn, rm, ra)
end

#smulh(rd, rn, rm) ⇒ Object



1953
1954
1955
# File 'lib/aarch64.rb', line 1953

def smulh rd, rn, rm
  a SMULH.new(rd, rn, rm)
end

#smull(rd, rn, rm) ⇒ Object



1957
1958
1959
# File 'lib/aarch64.rb', line 1957

def smull rd, rn, rm
  smaddl rd, rn, rm, XZR
end

#ssbbObject



1961
1962
1963
# File 'lib/aarch64.rb', line 1961

def ssbb
  dsb 0
end

#st2g(rt, rn, imm = nil) ⇒ Object



1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
# File 'lib/aarch64.rb', line 1965

def st2g rt, rn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a ST2G.new(rt, rn.first, (rn[1] || 0) / 16, 0b11)
    else
      # Post index
      a ST2G.new(rt, rn.first, (imm || 0) / 16, 0b01)
    end
  else
    # Signed offset
    a ST2G.new(rt, rn.first, (rn[1] || 0) / 16, 0b10)
  end
end

#st64b(rt, rn) ⇒ Object



1980
1981
1982
# File 'lib/aarch64.rb', line 1980

def st64b rt, rn
  a ST64B.new(rt, rn.first)
end

#st64bv(rs, rt, rn) ⇒ Object



1984
1985
1986
# File 'lib/aarch64.rb', line 1984

def st64bv rs, rt, rn
  a ST64BV.new(rs, rt, rn.first)
end

#st64bv0(rs, rt, rn) ⇒ Object



1988
1989
1990
# File 'lib/aarch64.rb', line 1988

def st64bv0 rs, rt, rn
  a ST64BV0.new(rs, rt, rn.first)
end

#stadd(rs, rn) ⇒ Object



1992
1993
1994
# File 'lib/aarch64.rb', line 1992

def stadd rs, rn
  ldadd rs, rs.zr, rn
end

#staddb(rs, rn) ⇒ Object



2000
2001
2002
# File 'lib/aarch64.rb', line 2000

def staddb rs, rn
  ldaddb rs, rs.zr, rn
end

#staddh(rs, rn) ⇒ Object



2008
2009
2010
# File 'lib/aarch64.rb', line 2008

def staddh rs, rn
  ldaddh rs, rs.zr, rn
end

#staddl(rs, rn) ⇒ Object



1996
1997
1998
# File 'lib/aarch64.rb', line 1996

def staddl rs, rn
  ldaddl rs, rs.zr, rn
end

#staddlb(rs, rn) ⇒ Object



2004
2005
2006
# File 'lib/aarch64.rb', line 2004

def staddlb rs, rn
  ldaddlb rs, rs.zr, rn
end

#staddlh(rs, rn) ⇒ Object



2012
2013
2014
# File 'lib/aarch64.rb', line 2012

def staddlh rs, rn
  ldaddlh rs, rs.zr, rn
end

#stclr(rs, rn) ⇒ Object



2016
2017
2018
# File 'lib/aarch64.rb', line 2016

def stclr rs, rn
  ldclr rs, rs.zr, rn
end

#stclrb(rs, rn) ⇒ Object



2024
2025
2026
# File 'lib/aarch64.rb', line 2024

def stclrb rs, rn
  ldclrb rs, rs.zr, rn
end

#stclrh(rs, rn) ⇒ Object



2032
2033
2034
# File 'lib/aarch64.rb', line 2032

def stclrh rs, rn
  ldclrh rs, rs.zr, rn
end

#stclrl(rs, rn) ⇒ Object



2020
2021
2022
# File 'lib/aarch64.rb', line 2020

def stclrl rs, rn
  ldclrl rs, rs.zr, rn
end

#stclrlb(rs, rn) ⇒ Object



2028
2029
2030
# File 'lib/aarch64.rb', line 2028

def stclrlb rs, rn
  ldclrlb rs, rs.zr, rn
end

#stclrlh(rs, rn) ⇒ Object



2036
2037
2038
# File 'lib/aarch64.rb', line 2036

def stclrlh rs, rn
  ldclrlh rs, rs.zr, rn
end

#steor(rs, rn) ⇒ Object



2040
2041
2042
# File 'lib/aarch64.rb', line 2040

def steor rs, rn
  ldeor rs, rs.zr, rn
end

#steorb(rs, rn) ⇒ Object



2048
2049
2050
# File 'lib/aarch64.rb', line 2048

def steorb rs, rn
  ldeorb rs, rs.zr, rn
end

#steorh(rs, rn) ⇒ Object



2056
2057
2058
# File 'lib/aarch64.rb', line 2056

def steorh rs, rn
  ldeorh rs, rs.zr, rn
end

#steorl(rs, rn) ⇒ Object



2044
2045
2046
# File 'lib/aarch64.rb', line 2044

def steorl rs, rn
  ldeorl rs, rs.zr, rn
end

#steorlb(rs, rn) ⇒ Object



2052
2053
2054
# File 'lib/aarch64.rb', line 2052

def steorlb rs, rn
  ldeorlb rs, rs.zr, rn
end

#steorlh(rs, rn) ⇒ Object



2060
2061
2062
# File 'lib/aarch64.rb', line 2060

def steorlh rs, rn
  ldeorlh rs, rs.zr, rn
end

#stg(rt, rn, imm = nil) ⇒ Object



2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
# File 'lib/aarch64.rb', line 2064

def stg rt, rn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a STG.new(rt, rn.first, (rn[1] || 0) / 16, 0b11)
    else
      # Post index
      a STG.new(rt, rn.first, (imm || 0) / 16, 0b01)
    end
  else
    # Signed offset
    a STG.new(rt, rn.first, (rn[1] || 0) / 16, 0b10)
  end
end

#stgm(rt, rn) ⇒ Object



2079
2080
2081
# File 'lib/aarch64.rb', line 2079

def stgm rt, rn
  a STGM.new(rt, rn.first)
end

#stgp(xt1, xt2, xn, imm = nil) ⇒ Object



2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
# File 'lib/aarch64.rb', line 2083

def stgp xt1, xt2, xn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a STGP.new(xt1, xt2, xn.first, (xn[1] || 0) / 16, 0b011)
    else
      # Post index
      a STGP.new(xt1, xt2, xn.first, imm / 16, 0b001)
    end
  else
    # Signed offset
    a STGP.new(xt1, xt2, xn.first, (xn[1] || 0) / 16, 0b010)
  end
end

#stllr(rt, rn) ⇒ Object



2098
2099
2100
# File 'lib/aarch64.rb', line 2098

def stllr rt, rn
  a STLLR.new(rt, rn.first, rt.sizeb)
end

#stllrb(rt, rn) ⇒ Object



2102
2103
2104
# File 'lib/aarch64.rb', line 2102

def stllrb rt, rn
  a STLLRB.new(rt, rn.first)
end

#stllrh(rt, rn) ⇒ Object



2106
2107
2108
# File 'lib/aarch64.rb', line 2106

def stllrh rt, rn
  a STLLRH.new(rt, rn.first)
end

#stlr(rt, rn) ⇒ Object



2110
2111
2112
# File 'lib/aarch64.rb', line 2110

def stlr rt, rn
  a STLR.new(rt, rn.first, rt.sizeb)
end

#stlrb(rt, rn) ⇒ Object



2114
2115
2116
# File 'lib/aarch64.rb', line 2114

def stlrb rt, rn
  a STLRB.new(rt, rn.first)
end

#stlrh(rt, rn) ⇒ Object



2118
2119
2120
# File 'lib/aarch64.rb', line 2118

def stlrh rt, rn
  a STLRH.new(rt, rn.first)
end

#stlur(rt, rn) ⇒ Object



2122
2123
2124
# File 'lib/aarch64.rb', line 2122

def stlur rt, rn
  a STLUR_gen.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#stlurb(rt, rn) ⇒ Object



2126
2127
2128
# File 'lib/aarch64.rb', line 2126

def stlurb rt, rn
  a STLUR_gen.new(rt, rn.first, rn[1] || 0, 0b00)
end

#stlurh(rt, rn) ⇒ Object



2130
2131
2132
# File 'lib/aarch64.rb', line 2130

def stlurh rt, rn
  a STLUR_gen.new(rt, rn.first, rn[1] || 0, 0b01)
end

#stlxp(rs, rt, rt2, rn) ⇒ Object



2134
2135
2136
# File 'lib/aarch64.rb', line 2134

def stlxp rs, rt, rt2, rn
  a STLXP.new(rs, rt, rt2, rn.first, rt.sizeb)
end

#stlxr(rs, rt, rn) ⇒ Object



2138
2139
2140
# File 'lib/aarch64.rb', line 2138

def stlxr rs, rt, rn
  a STLXR.new(rs, rt, rn.first, rt.sizeb)
end

#stlxrb(rs, rt, rn) ⇒ Object



2142
2143
2144
# File 'lib/aarch64.rb', line 2142

def stlxrb rs, rt, rn
  a STLXRB.new(rs, rt, rn.first)
end

#stlxrh(rs, rt, rn) ⇒ Object



2146
2147
2148
# File 'lib/aarch64.rb', line 2146

def stlxrh rs, rt, rn
  a STLXRH.new(rs, rt, rn.first)
end

#stnp(rt, rt2, rn) ⇒ Object



2150
2151
2152
# File 'lib/aarch64.rb', line 2150

def stnp rt, rt2, rn
  a STNP_gen.new(rt, rt2, rn.first, (rn[1] || 0) / (rt.size / 8), rt.opc3)
end

#stp(rt, rt2, rn, imm = nil) ⇒ Object



2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
# File 'lib/aarch64.rb', line 2154

def stp rt, rt2, rn, imm = nil
  div = rt.size / 8

  if imm
    if imm == :!
      # Pre index
      a STP_gen.new(rt, rt2, rn.first, (rn[1] || 0) / div, rt.opc3, 0b011)
    else
      # Post index
      a STP_gen.new(rt, rt2, rn.first, imm / div, rt.opc3, 0b001)
    end
  else
    # Signed offset
    a STP_gen.new(rt, rt2, rn.first, (rn[1] || 0) / div, rt.opc3, 0b010)
  end
end

#str(rt, rn, imm = nil) ⇒ Object



2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
# File 'lib/aarch64.rb', line 2171

def str rt, rn, imm = nil
  if imm
    if imm == :!
      # Post index
      a STR_imm_gen.new(rt, rn.first, rn[1] || 0, 0b11, rt.sizeb)
    else
      # Pre index
      a STR_imm_gen.new(rt, rn.first, imm || 0, 0b01, rt.sizeb)
    end
  else
    imm = rn[1] || 0
    if imm.integer?
      # Unsigned
      div = rt.size / 8
      a STR_imm_unsigned.new(rt, rn.first, imm / div, rt.sizeb)
    else
      rn, rm, opt = *rn
      opt ||= Extends::Extend.new(0, 0, :lsl)
      extend = case opt.name
               when :uxtw then 0b010
               when :lsl  then 0b011
               when :sxtw then 0b110
               when :sxtx then 0b111
               else
                 raise "Unknown type #{opt.name}"
               end

      amount = opt.amount / (rt.x? ? 3 : 2)
      a STR_reg_gen.new(rt, rn, rm, extend, amount, rt.sizeb)
    end
  end
end

#strb(rt, rn, imm = nil) ⇒ Object



2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
# File 'lib/aarch64.rb', line 2204

def strb rt, rn, imm = nil
  if imm
    if imm == :!
      # Post index
      a STRB_imm.new(rt, rn.first, rn[1] || 0, 0b11)
    else
      # Pre index
      a STRB_imm.new(rt, rn.first, imm, 0b01)
    end
  else
    imm = rn[1] || 0
    if imm.integer?
      # Unsigned
      a STRB_imm_unsigned.new(rt, rn.first, imm)
    else
      amount = rn[2] ? 1 : 0

      rn, rm, opt = *rn
      opt ||= Extends::Extend.new(0, 0, :lsl)
      extend = case opt.name
               when :uxtw then 0b010
               when :lsl  then 0b011
               when :sxtw then 0b110
               when :sxtx then 0b111
               else
                 raise "Unknown type #{opt.name}"
               end

      a STRB_reg.new(rt, rn, rm, extend, amount)
    end
  end
end

#strh(rt, rn, imm = nil) ⇒ Object



2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
# File 'lib/aarch64.rb', line 2237

def strh rt, rn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a STRH_imm.new(rt, rn.first, rn[1] || 0, 0b11)
    else
      # Post index
      a STRH_imm.new(rt, rn.first, imm, 0b01)
    end
  else
    imm = rn[1] || 0
    if imm.integer?
      # Unsigned
      a STRH_imm_unsigned.new(rt, rn.first, imm >> 1)
    else
      rn, rm, opt = *rn
      opt ||= Extends::Extend.new(0, 0, :lsl)
      extend = case opt.name
               when :uxtw then 0b010
               when :lsl  then 0b011
               when :sxtw then 0b110
               when :sxtx then 0b111
               else
                 raise "Unknown type #{opt.name}"
               end

      amount = opt.amount > 0 ? 1 : 0

      a STRH_reg.new(rt, rn, rm, extend, amount)
    end
  end
end

#stset(rs, rn) ⇒ Object



2270
2271
2272
# File 'lib/aarch64.rb', line 2270

def stset rs, rn
  ldset rs, rs.zr, rn
end

#stsetb(rs, rn) ⇒ Object



2278
2279
2280
# File 'lib/aarch64.rb', line 2278

def stsetb rs, rn
  ldsetb rs, rs.zr, rn
end

#stseth(rs, rn) ⇒ Object



2286
2287
2288
# File 'lib/aarch64.rb', line 2286

def stseth rs, rn
  ldseth rs, rs.zr, rn
end

#stsetl(rs, rn) ⇒ Object



2274
2275
2276
# File 'lib/aarch64.rb', line 2274

def stsetl rs, rn
  ldsetl rs, rs.zr, rn
end

#stsetlb(rs, rn) ⇒ Object



2282
2283
2284
# File 'lib/aarch64.rb', line 2282

def stsetlb rs, rn
  ldsetlb rs, rs.zr, rn
end

#stsetlh(rs, rn) ⇒ Object



2290
2291
2292
# File 'lib/aarch64.rb', line 2290

def stsetlh rs, rn
  ldsetlh rs, rs.zr, rn
end

#stsmax(rs, rn) ⇒ Object



2294
2295
2296
# File 'lib/aarch64.rb', line 2294

def stsmax rs, rn
  ldsmax rs, rs.zr, rn
end

#stsmaxb(rs, rn) ⇒ Object



2302
2303
2304
# File 'lib/aarch64.rb', line 2302

def stsmaxb rs, rn
  ldsmaxb rs, rs.zr, rn
end

#stsmaxh(rs, rn) ⇒ Object



2310
2311
2312
# File 'lib/aarch64.rb', line 2310

def stsmaxh rs, rn
  ldsmaxh rs, rs.zr, rn
end

#stsmaxl(rs, rn) ⇒ Object



2298
2299
2300
# File 'lib/aarch64.rb', line 2298

def stsmaxl rs, rn
  ldsmaxl rs, rs.zr, rn
end

#stsmaxlb(rs, rn) ⇒ Object



2306
2307
2308
# File 'lib/aarch64.rb', line 2306

def stsmaxlb rs, rn
  ldsmaxlb rs, rs.zr, rn
end

#stsmaxlh(rs, rn) ⇒ Object



2314
2315
2316
# File 'lib/aarch64.rb', line 2314

def stsmaxlh rs, rn
  ldsmaxlh rs, rs.zr, rn
end

#stsmin(rs, rn) ⇒ Object



2318
2319
2320
# File 'lib/aarch64.rb', line 2318

def stsmin rs, rn
  ldsmin rs, rs.zr, rn
end

#stsminb(rs, rn) ⇒ Object



2326
2327
2328
# File 'lib/aarch64.rb', line 2326

def stsminb rs, rn
  ldsminb rs, rs.zr, rn
end

#stsminh(rs, rn) ⇒ Object



2334
2335
2336
# File 'lib/aarch64.rb', line 2334

def stsminh rs, rn
  ldsminh rs, rs.zr, rn
end

#stsminl(rs, rn) ⇒ Object



2322
2323
2324
# File 'lib/aarch64.rb', line 2322

def stsminl rs, rn
  ldsminl rs, rs.zr, rn
end

#stsminlb(rs, rn) ⇒ Object



2330
2331
2332
# File 'lib/aarch64.rb', line 2330

def stsminlb rs, rn
  ldsminlb rs, rs.zr, rn
end

#stsminlh(rs, rn) ⇒ Object



2338
2339
2340
# File 'lib/aarch64.rb', line 2338

def stsminlh rs, rn
  ldsminlh rs, rs.zr, rn
end

#sttr(rt, rn) ⇒ Object



2342
2343
2344
# File 'lib/aarch64.rb', line 2342

def sttr rt, rn
  a STTR.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#sttrb(rt, rn) ⇒ Object



2346
2347
2348
# File 'lib/aarch64.rb', line 2346

def sttrb rt, rn
  a STTR.new(rt, rn.first, rn[1] || 0, 0b00)
end

#sttrh(rt, rn) ⇒ Object



2350
2351
2352
# File 'lib/aarch64.rb', line 2350

def sttrh rt, rn
  a STTR.new(rt, rn.first, rn[1] || 0, 0b01)
end

#stumax(rs, rn) ⇒ Object



2354
2355
2356
# File 'lib/aarch64.rb', line 2354

def stumax rs, rn
  ldumax rs, rs.zr, rn
end

#stumaxb(rs, rn) ⇒ Object



2362
2363
2364
# File 'lib/aarch64.rb', line 2362

def stumaxb rs, rn
  ldumaxb rs, rs.zr, rn
end

#stumaxh(rs, rn) ⇒ Object



2370
2371
2372
# File 'lib/aarch64.rb', line 2370

def stumaxh rs, rn
  ldumaxh rs, rs.zr, rn
end

#stumaxl(rs, rn) ⇒ Object



2358
2359
2360
# File 'lib/aarch64.rb', line 2358

def stumaxl rs, rn
  ldumaxl rs, rs.zr, rn
end

#stumaxlb(rs, rn) ⇒ Object



2366
2367
2368
# File 'lib/aarch64.rb', line 2366

def stumaxlb rs, rn
  ldumaxlb rs, rs.zr, rn
end

#stumaxlh(rs, rn) ⇒ Object



2374
2375
2376
# File 'lib/aarch64.rb', line 2374

def stumaxlh rs, rn
  ldumaxlh rs, rs.zr, rn
end

#stumin(rs, rn) ⇒ Object



2378
2379
2380
# File 'lib/aarch64.rb', line 2378

def stumin rs, rn
  ldumin rs, rs.zr, rn
end

#stuminb(rs, rn) ⇒ Object



2386
2387
2388
# File 'lib/aarch64.rb', line 2386

def stuminb rs, rn
  lduminb rs, rs.zr, rn
end

#stuminh(rs, rn) ⇒ Object



2394
2395
2396
# File 'lib/aarch64.rb', line 2394

def stuminh rs, rn
  lduminh rs, rs.zr, rn
end

#stuminl(rs, rn) ⇒ Object



2382
2383
2384
# File 'lib/aarch64.rb', line 2382

def stuminl rs, rn
  lduminl rs, rs.zr, rn
end

#stuminlb(rs, rn) ⇒ Object



2390
2391
2392
# File 'lib/aarch64.rb', line 2390

def stuminlb rs, rn
  lduminlb rs, rs.zr, rn
end

#stuminlh(rs, rn) ⇒ Object



2398
2399
2400
# File 'lib/aarch64.rb', line 2398

def stuminlh rs, rn
  lduminlh rs, rs.zr, rn
end

#stur(rt, rn) ⇒ Object



2402
2403
2404
# File 'lib/aarch64.rb', line 2402

def stur rt, rn
  a STUR_gen.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#sturb(rt, rn) ⇒ Object



2406
2407
2408
# File 'lib/aarch64.rb', line 2406

def sturb rt, rn
  a STUR_gen.new(rt, rn.first, rn[1] || 0, 0b00)
end

#sturh(rt, rn) ⇒ Object



2410
2411
2412
# File 'lib/aarch64.rb', line 2410

def sturh rt, rn
  a STUR_gen.new(rt, rn.first, rn[1] || 0, 0b01)
end

#stxp(rs, rt1, rt2, rn) ⇒ Object



2414
2415
2416
# File 'lib/aarch64.rb', line 2414

def stxp rs, rt1, rt2, rn
  a STXP.new(rs, rt1, rt2, rn.first, rt1.sf)
end

#stxr(rs, rt, rn) ⇒ Object



2418
2419
2420
# File 'lib/aarch64.rb', line 2418

def stxr rs, rt, rn
  a STXR.new(rs, rt, rn.first, rt.opc2)
end

#stxrb(rs, rt, rn) ⇒ Object



2422
2423
2424
# File 'lib/aarch64.rb', line 2422

def stxrb rs, rt, rn
  a STXRB.new(rs, rt, rn.first)
end

#stxrh(rs, rt, rn) ⇒ Object



2426
2427
2428
# File 'lib/aarch64.rb', line 2426

def stxrh rs, rt, rn
  a STXRH.new(rs, rt, rn.first)
end

#stz2g(rt, rn, imm = nil) ⇒ Object



2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
# File 'lib/aarch64.rb', line 2430

def stz2g rt, rn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a STZ2G.new(rt, rn.first, (rn[1] || 0) / 16, 0b11)
    else
      a STZ2G.new(rt, rn.first, imm / 16, 0b01)
    end
  else
    # Signed offset
    a STZ2G.new(rt, rn.first, (rn[1] || 0) / 16, 0b10)
  end
end

#stzg(rt, rn, imm = nil) ⇒ Object



2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
# File 'lib/aarch64.rb', line 2444

def stzg rt, rn, imm = nil
  if imm
    if imm == :!
      # Pre index
      a STZG.new(rt, rn.first, (rn[1] || 0) / 16, 0b11)
    else
      a STZG.new(rt, rn.first, imm / 16, 0b01)
    end
  else
    # Signed offset
    a STZG.new(rt, rn.first, (rn[1] || 0) / 16, 0b10)
  end
end

#stzgm(rt, rn) ⇒ Object



2458
2459
2460
# File 'lib/aarch64.rb', line 2458

def stzgm rt, rn
  a STZGM.new(rt, rn.first)
end

#sub(d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl) ⇒ Object



2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
# File 'lib/aarch64.rb', line 2509

def sub d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl
  if (d.sp? || n.sp?) && !m.integer?
    if n.x?
      extend ||= :uxtx
    else
      extend ||= :uxtw
    end
  end

  if option
    if option.extend?
      extend = option.name
      amount = option.amount
    else
      if m.integer?
        lsl = option.amount
      else
        shift = option.name
        amount = option.amount
      end
    end
  end

  if extend
    extend = case extend
             when :uxtb then 0b000
             when :uxth then 0b001
             when :uxtw then 0b010
             when :uxtx then 0b011
             when :sxtb then 0b100
             when :sxth then 0b101
             when :sxtw then 0b110
             when :sxtx then 0b111
             else
               raise "Unknown extend #{extend}"
             end
    a SUB_addsub_ext.new(d, n, m, extend, amount, d.sf)
  else
    if m.integer?
      a SUB_addsub_imm.new(d, n, m, lsl / 12, d.sf)
    else
      shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
      a SUB_addsub_shift.new(d, n, m, shift, amount, d.sf)
    end
  end
end

#subg(xd, xn, uimm6, uimm4) ⇒ Object

Raises:

  • (NotImplementedError)


2556
2557
2558
2559
# File 'lib/aarch64.rb', line 2556

def subg xd, xn, uimm6, uimm4
  raise NotImplementedError unless xd.x?
  a SUBG.new(xd, xn, uimm6, uimm4)
end

#subp(xd, xn, xm) ⇒ Object

Raises:

  • (NotImplementedError)


2561
2562
2563
2564
# File 'lib/aarch64.rb', line 2561

def subp xd, xn, xm
  raise NotImplementedError unless xd.x?
  a SUBP.new(xd, xn, xm)
end

#subps(xd, xn, xm) ⇒ Object

Raises:

  • (NotImplementedError)


2566
2567
2568
2569
# File 'lib/aarch64.rb', line 2566

def subps xd, xn, xm
  raise NotImplementedError unless xd.x?
  a SUBPS.new(xd, xn, xm)
end

#subs(d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl) ⇒ Object



2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
# File 'lib/aarch64.rb', line 2462

def subs d, n, m, option = nil, extend: nil, amount: 0, lsl: 0, shift: :lsl
  if n.sp? && !m.integer?
    if n.x?
      extend ||= :uxtx
    else
      extend ||= :uxtw
    end
  end

  if option
    if option.extend?
      extend = option.name
      amount = option.amount
    else
      if m.integer?
        lsl = option.amount
      else
        shift = option.name
        amount = option.amount
      end
    end
  end

  if extend
    extend = case extend
             when :uxtb then 0b000
             when :uxth then 0b001
             when :uxtw then 0b010
             when :uxtx then 0b011
             when :sxtb then 0b100
             when :sxth then 0b101
             when :sxtw then 0b110
             when :sxtx then 0b111
             else
               raise "Unknown extend #{extend}"
             end
    a SUBS_addsub_ext.new(d, n, m, extend, amount, d.sf)
  else
    if m.integer?
      a SUBS_addsub_imm.new(d, n, m, lsl / 12, d.sf)
    else
      shift = [:lsl, :lsr, :asr].index(shift) || raise(NotImplementedError)
      a SUBS_addsub_shift.new(d, n, m, shift, amount, d.sf)
    end
  end
end

#svc(imm) ⇒ Object



2571
2572
2573
# File 'lib/aarch64.rb', line 2571

def svc imm
  a SVC.new(imm)
end

#swp(rs, rt, rn) ⇒ Object



2575
2576
2577
# File 'lib/aarch64.rb', line 2575

def swp rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#swpa(rs, rt, rn) ⇒ Object



2587
2588
2589
# File 'lib/aarch64.rb', line 2587

def swpa rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#swpab(rs, rt, rn) ⇒ Object



2591
2592
2593
# File 'lib/aarch64.rb', line 2591

def swpab rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 1, 0)
end

#swpah(rs, rt, rn) ⇒ Object



2607
2608
2609
# File 'lib/aarch64.rb', line 2607

def swpah rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 1, 0)
end

#swpal(rs, rt, rn) ⇒ Object



2579
2580
2581
# File 'lib/aarch64.rb', line 2579

def swpal rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#swpalb(rs, rt, rn) ⇒ Object



2595
2596
2597
# File 'lib/aarch64.rb', line 2595

def swpalb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 1, 1)
end

#swpalh(rs, rt, rn) ⇒ Object



2611
2612
2613
# File 'lib/aarch64.rb', line 2611

def swpalh rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 1, 1)
end

#swpb(rs, rt, rn) ⇒ Object



2599
2600
2601
# File 'lib/aarch64.rb', line 2599

def swpb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 0, 0)
end

#swph(rs, rt, rn) ⇒ Object



2615
2616
2617
# File 'lib/aarch64.rb', line 2615

def swph rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 0, 0)
end

#swpl(rs, rt, rn) ⇒ Object



2583
2584
2585
# File 'lib/aarch64.rb', line 2583

def swpl rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#swplb(rs, rt, rn) ⇒ Object



2603
2604
2605
# File 'lib/aarch64.rb', line 2603

def swplb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 0, 1)
end

#swplh(rs, rt, rn) ⇒ Object



2619
2620
2621
# File 'lib/aarch64.rb', line 2619

def swplh rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 0, 1)
end

#sxtb(rd, rn) ⇒ Object



2623
2624
2625
# File 'lib/aarch64.rb', line 2623

def sxtb rd, rn
  sbfm rd, rn, 0, 7
end

#sxth(rd, rn) ⇒ Object



2627
2628
2629
# File 'lib/aarch64.rb', line 2627

def sxth rd, rn
  sbfm rd, rn, 0, 15
end

#sxtw(rd, rn) ⇒ Object



2631
2632
2633
# File 'lib/aarch64.rb', line 2631

def sxtw rd, rn
  sbfm rd, rn, 0, 31
end

#sys(op1, cn, cm, op2, xt = XZR) ⇒ Object



2635
2636
2637
# File 'lib/aarch64.rb', line 2635

def sys op1, cn, cm, op2, xt = XZR
  a SYS.new(op1, cn, cm, op2, xt)
end

#sysl(xt, op1, cn, cm, op2) ⇒ Object



2639
2640
2641
# File 'lib/aarch64.rb', line 2639

def sysl xt, op1, cn, cm, op2
  a SYSL.new(xt, op1, cn, cm, op2)
end

#tbnz(rt, imm, label) ⇒ Object



2643
2644
2645
# File 'lib/aarch64.rb', line 2643

def tbnz rt, imm, label
  a TBNZ.new(rt, imm, label, rt.sf)
end

#tbz(rt, imm, label) ⇒ Object



2647
2648
2649
# File 'lib/aarch64.rb', line 2647

def tbz rt, imm, label
  a TBZ.new(rt, imm, label, rt.sf)
end

#tlbi(tlbi_op, xt = XZR) ⇒ Object



2651
2652
2653
2654
# File 'lib/aarch64.rb', line 2651

def tlbi tlbi_op, xt = XZR
  op1, crm, op2 = Utils.tlbi_op(tlbi_op)
  sys op1, Names::C8, crm, op2, xt
end

#to_binaryObject



2757
2758
2759
# File 'lib/aarch64.rb', line 2757

def to_binary
  @insns.map(&:encode).pack("L<*")
end

#tsb(_) ⇒ Object



2656
2657
2658
# File 'lib/aarch64.rb', line 2656

def tsb _
  a TSB.new
end

#tst(rn, rm, option = nil, shift: :lsl, amount: 0) ⇒ Object



2660
2661
2662
2663
2664
2665
2666
2667
# File 'lib/aarch64.rb', line 2660

def tst rn, rm, option = nil, shift: :lsl, amount: 0
  if option
    shift = option.name
    amount = option.amount
  end

  ands rn.zr, rn, rm, shift: shift, amount: amount
end

#ubfiz(rd, rn, lsb, width) ⇒ Object



2673
2674
2675
# File 'lib/aarch64.rb', line 2673

def ubfiz rd, rn, lsb, width
  ubfm rd, rn, (-lsb) % rd.size, width - 1
end

#ubfm(rd, rn, immr, imms) ⇒ Object



2669
2670
2671
# File 'lib/aarch64.rb', line 2669

def ubfm rd, rn, immr, imms
  a UBFM.new(rd, rn, immr, imms, rd.sf)
end

#ubfx(rd, rn, lsb, width) ⇒ Object



2677
2678
2679
# File 'lib/aarch64.rb', line 2677

def ubfx rd, rn, lsb, width
  ubfm rd, rn, lsb, lsb + width - 1
end

#udf(imm) ⇒ Object



2681
2682
2683
# File 'lib/aarch64.rb', line 2681

def udf imm
  a UDF_perm_undef.new(imm)
end

#udiv(rd, rn, rm) ⇒ Object



2685
2686
2687
# File 'lib/aarch64.rb', line 2685

def udiv rd, rn, rm
  a UDIV.new(rd, rn, rm, rd.sf)
end

#umaddl(xd, wn, wm, xa) ⇒ Object



2689
2690
2691
# File 'lib/aarch64.rb', line 2689

def umaddl xd, wn, wm, xa
  a UMADDL.new(xd, wn, wm, xa)
end

#umnegl(xd, wn, wm) ⇒ Object



2693
2694
2695
# File 'lib/aarch64.rb', line 2693

def umnegl xd, wn, wm
  umsubl xd, wn, wm, XZR
end

#umsubl(xd, wn, wm, xa) ⇒ Object



2697
2698
2699
# File 'lib/aarch64.rb', line 2697

def umsubl xd, wn, wm, xa
  a UMSUBL.new(xd, wn, wm, xa)
end

#umulh(rd, rn, rm) ⇒ Object



2701
2702
2703
# File 'lib/aarch64.rb', line 2701

def umulh rd, rn, rm
  a UMULH.new(rd, rn, rm)
end

#umull(xd, wn, wm) ⇒ Object



2705
2706
2707
# File 'lib/aarch64.rb', line 2705

def umull xd, wn, wm
  umaddl xd, wn, wm, XZR
end

#uxtb(rd, rn) ⇒ Object



2709
2710
2711
# File 'lib/aarch64.rb', line 2709

def uxtb rd, rn
  ubfm rd, rn, 0, 7
end

#uxth(rd, rn) ⇒ Object



2713
2714
2715
# File 'lib/aarch64.rb', line 2713

def uxth rd, rn
  ubfm rd, rn, 0, 15
end

#wfeObject



2717
2718
2719
# File 'lib/aarch64.rb', line 2717

def wfe
  a WFE.new
end

#wfet(rd) ⇒ Object



2721
2722
2723
# File 'lib/aarch64.rb', line 2721

def wfet rd
  a WFET.new(rd)
end

#wfiObject



2725
2726
2727
# File 'lib/aarch64.rb', line 2725

def wfi
  a WFI.new
end

#wfit(rd) ⇒ Object



2729
2730
2731
# File 'lib/aarch64.rb', line 2729

def wfit rd
  a WFIT.new(rd)
end

#write_to(io) ⇒ Object



2753
2754
2755
# File 'lib/aarch64.rb', line 2753

def write_to io
  io.write to_binary
end

#xaflagObject



2733
2734
2735
# File 'lib/aarch64.rb', line 2733

def xaflag
  a XAFLAG.new
end

#xpacd(rd) ⇒ Object



2737
2738
2739
# File 'lib/aarch64.rb', line 2737

def xpacd rd
  a XPAC.new(rd, 1)
end

#xpaci(rd) ⇒ Object



2741
2742
2743
# File 'lib/aarch64.rb', line 2741

def xpaci rd
  a XPAC.new(rd, 0)
end

#xpaclriObject



2745
2746
2747
# File 'lib/aarch64.rb', line 2745

def xpaclri
  a XPACLRI.new
end

#yieldObject



2749
2750
2751
# File 'lib/aarch64.rb', line 2749

def yield
  a YIELD.new
end