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.



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

def initialize
  @insns = []
end

Instance Method Details

#adc(d, n, m) ⇒ Object



179
180
181
# File 'lib/aarch64.rb', line 179

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

#adcs(d, n, m) ⇒ Object



183
184
185
# File 'lib/aarch64.rb', line 183

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



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
212
213
# File 'lib/aarch64.rb', line 187

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 :lsl  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 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 || 0) / 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



215
216
217
# File 'lib/aarch64.rb', line 215

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



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
263
264
265
# File 'lib/aarch64.rb', line 219

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 :lsl 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



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

def adr xd, label
  if label.integer?
    label = wrap_offset_with_label label
  end
  a ADR.new(xd, label)
end

#adrp(xd, label) ⇒ Object



274
275
276
# File 'lib/aarch64.rb', line 274

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

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



278
279
280
281
282
283
284
285
286
# File 'lib/aarch64.rb', line 278

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, :ror].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



288
289
290
291
292
293
294
295
296
# File 'lib/aarch64.rb', line 288

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, :ror].index(shift) || raise(NotImplementedError)
    a ANDS_log_shift.new(d, n, m, shift, amount, d.sf)
  end
end

#asr(d, n, m) ⇒ Object



298
299
300
301
302
303
304
# File 'lib/aarch64.rb', line 298

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



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

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

#at(at_op, t) ⇒ Object



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

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



315
316
317
318
319
320
321
# File 'lib/aarch64.rb', line 315

def autda d, n
  if n.integer?
    a AUTDA.new(1, d, n)
  else
    a AUTDA.new(0, d, n)
  end
end

#autdb(d, n) ⇒ Object



327
328
329
330
331
332
333
# File 'lib/aarch64.rb', line 327

def autdb d, n
  if n.integer?
    a AUTDB.new(1, d, n)
  else
    a AUTDB.new(0, d, n)
  end
end

#autdza(d) ⇒ Object



323
324
325
# File 'lib/aarch64.rb', line 323

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

#autdzb(d) ⇒ Object



335
336
337
# File 'lib/aarch64.rb', line 335

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

#autia(d, n) ⇒ Object



339
340
341
342
343
344
345
# File 'lib/aarch64.rb', line 339

def autia d, n
  if n.integer?
    a AUTIA.new(1, d, n)
  else
    a AUTIA.new(0, d, n)
  end
end

#autia1716Object



351
352
353
# File 'lib/aarch64.rb', line 351

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

#autiaspObject



355
356
357
# File 'lib/aarch64.rb', line 355

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

#autiazObject



359
360
361
# File 'lib/aarch64.rb', line 359

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

#autib(d, n) ⇒ Object



363
364
365
366
367
368
369
# File 'lib/aarch64.rb', line 363

def autib d, n
  if n.integer?
    a AUTIB.new(1, d, n)
  else
    a AUTIB.new(0, d, n)
  end
end

#autib1716Object



375
376
377
# File 'lib/aarch64.rb', line 375

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

#autibspObject



379
380
381
# File 'lib/aarch64.rb', line 379

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

#autibzObject



383
384
385
# File 'lib/aarch64.rb', line 383

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

#autiza(d) ⇒ Object



347
348
349
# File 'lib/aarch64.rb', line 347

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

#autizb(d) ⇒ Object



371
372
373
# File 'lib/aarch64.rb', line 371

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

#axflagObject



387
388
389
# File 'lib/aarch64.rb', line 387

def axflag
  a AXFLAG.new
end

#b(label, cond: nil) ⇒ Object



391
392
393
394
395
396
397
398
399
400
401
# File 'lib/aarch64.rb', line 391

def b label, cond: nil
  if label.integer?
    label = wrap_offset_with_label label
  end

  if cond
    a B_cond.new(Utils.cond2bin(cond), label)
  else
    a B_uncond.new(label)
  end
end

#bc(label, cond:) ⇒ Object



403
404
405
406
407
408
# File 'lib/aarch64.rb', line 403

def bc label, cond:
  if label.integer?
    label = wrap_offset_with_label label
  end
  a BC_cond.new(Utils.cond2bin(cond), label)
end

#bfc(rd, lsb, width) ⇒ Object



410
411
412
# File 'lib/aarch64.rb', line 410

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

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



414
415
416
# File 'lib/aarch64.rb', line 414

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

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



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

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

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



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

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



426
427
428
429
430
431
432
433
434
# File 'lib/aarch64.rb', line 426

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



436
437
438
439
440
441
442
443
444
# File 'lib/aarch64.rb', line 436

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



446
447
448
449
450
451
452
# File 'lib/aarch64.rb', line 446

def bl label
  if label.integer?
    label = wrap_offset_with_label label
  end

  a BL.new(label)
end

#blr(n) ⇒ Object



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

def blr n
  a BLR.new(n)
end

#blraa(rn, rm) ⇒ Object



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

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

#blraaz(rn) ⇒ Object



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

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

#blrab(rn, rm) ⇒ Object



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

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

#blrabz(rn) ⇒ Object



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

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

#br(rn) ⇒ Object



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

def br rn
  a BR.new(rn)
end

#braa(rn, rm) ⇒ Object



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

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

#braaz(rn) ⇒ Object



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

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

#brab(rn, rm) ⇒ Object



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

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

#brabz(rn) ⇒ Object



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

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

#brk(imm) ⇒ Object



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

def brk imm
  a BRK.new(imm)
end

#bti(target) ⇒ Object



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

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

#cas(s, t, n_list) ⇒ Object



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

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



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

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



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

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

#casal(s, t, n_list) ⇒ Object



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

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



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

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

#casalh(rs, rt, rn_list) ⇒ Object



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

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

#casb(rs, rt, rn_list) ⇒ Object



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

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

#cash(rs, rt, rn_list) ⇒ Object



539
540
541
# File 'lib/aarch64.rb', line 539

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

#casl(s, t, n_list) ⇒ Object



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

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



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

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

#caslh(rs, rt, rn_list) ⇒ Object



543
544
545
# File 'lib/aarch64.rb', line 543

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



547
548
549
# File 'lib/aarch64.rb', line 547

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



551
552
553
# File 'lib/aarch64.rb', line 551

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



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

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



555
556
557
# File 'lib/aarch64.rb', line 555

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



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

def cbnz rt, label
  if label.integer?
    label = wrap_offset_with_label label
  end
  a CBNZ.new(rt, label, rt.sf)
end

#cbz(rt, label) ⇒ Object



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

def cbz rt, label
  if label.integer?
    label = wrap_offset_with_label label
  end
  a CBZ.new(rt, label, rt.sf)
end

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



577
578
579
580
581
582
583
584
585
# File 'lib/aarch64.rb', line 577

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



587
588
589
590
591
592
593
594
595
# File 'lib/aarch64.rb', line 587

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



597
598
599
# File 'lib/aarch64.rb', line 597

def cfinv
  a CFINV.new
end

#cfp_rcfx(rt) ⇒ Object



601
602
603
# File 'lib/aarch64.rb', line 601

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

#cinc(rd, rn, cond) ⇒ Object



605
606
607
# File 'lib/aarch64.rb', line 605

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

#cinv(rd, rn, cond) ⇒ Object



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

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

#clrex(imm = 15) ⇒ Object



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

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

#cls(rd, rn) ⇒ Object



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

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

#clz(rd, rn) ⇒ Object



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

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



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

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



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

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



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

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

#cneg(rd, rn, cond) ⇒ Object



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

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

#cpp(_, xn) ⇒ Object



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

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

#crc32b(rd, rn, rm) ⇒ Object



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

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

#crc32cb(rd, rn, rm) ⇒ Object



678
679
680
# File 'lib/aarch64.rb', line 678

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

#crc32ch(rd, rn, rm) ⇒ Object



682
683
684
# File 'lib/aarch64.rb', line 682

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

#crc32cw(rd, rn, rm) ⇒ Object



686
687
688
# File 'lib/aarch64.rb', line 686

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

#crc32cx(rd, rn, rm) ⇒ Object



690
691
692
# File 'lib/aarch64.rb', line 690

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

#crc32h(rd, rn, rm) ⇒ Object



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

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

#crc32w(rd, rn, rm) ⇒ Object



670
671
672
# File 'lib/aarch64.rb', line 670

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

#crc32x(rd, rn, rm) ⇒ Object



674
675
676
# File 'lib/aarch64.rb', line 674

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

#csdbObject



694
695
696
# File 'lib/aarch64.rb', line 694

def csdb
  a CSDB.new
end

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



698
699
700
# File 'lib/aarch64.rb', line 698

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

#cset(rd, cond) ⇒ Object



609
610
611
# File 'lib/aarch64.rb', line 609

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

#csetm(rd, cond) ⇒ Object



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

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



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

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

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



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

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

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



702
703
704
# File 'lib/aarch64.rb', line 702

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

#dc(dc_op, xt) ⇒ Object



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

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



711
712
713
# File 'lib/aarch64.rb', line 711

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

#dcps2(imm = 0) ⇒ Object



715
716
717
# File 'lib/aarch64.rb', line 715

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

#dcps3(imm = 0) ⇒ Object



719
720
721
# File 'lib/aarch64.rb', line 719

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

#dghObject



723
724
725
# File 'lib/aarch64.rb', line 723

def dgh
  a DGH.new
end

#dmb(option) ⇒ Object



727
728
729
730
731
732
733
# File 'lib/aarch64.rb', line 727

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

#drpsObject



735
736
737
# File 'lib/aarch64.rb', line 735

def drps
  a DRPS.new
end

#dsb(option) ⇒ Object



739
740
741
742
743
744
745
# File 'lib/aarch64.rb', line 739

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

#dvp(_, xt) ⇒ Object



747
748
749
# File 'lib/aarch64.rb', line 747

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

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



751
752
753
754
755
756
757
758
759
# File 'lib/aarch64.rb', line 751

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



761
762
763
764
765
766
767
768
769
770
771
772
773
774
# File 'lib/aarch64.rb', line 761

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



776
777
778
# File 'lib/aarch64.rb', line 776

def eret
  a ERET.new
end

#eretaaObject



780
781
782
# File 'lib/aarch64.rb', line 780

def eretaa
  a ERETA.new(0)
end

#eretabObject



784
785
786
# File 'lib/aarch64.rb', line 784

def eretab
  a ERETA.new(1)
end

#esbObject



788
789
790
# File 'lib/aarch64.rb', line 788

def esb
  a ESB.new
end

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



792
793
794
# File 'lib/aarch64.rb', line 792

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

#gmi(rd, rn, rm) ⇒ Object



796
797
798
# File 'lib/aarch64.rb', line 796

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

#hint(imm) ⇒ Object



800
801
802
# File 'lib/aarch64.rb', line 800

def hint imm
  a HINT.new(imm >> 3, imm & 0b111)
end

#hlt(imm) ⇒ Object



804
805
806
# File 'lib/aarch64.rb', line 804

def hlt imm
  a HLT.new(imm)
end

#hvc(imm) ⇒ Object



808
809
810
# File 'lib/aarch64.rb', line 808

def hvc imm
  a HVC.new(imm)
end

#ic(op, xt = SP) ⇒ Object



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

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



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

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

#isb(option = 0b1111) ⇒ Object



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

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

#ld64b(rt, rn) ⇒ Object



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

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

#ldadd(rs, rt, rn) ⇒ Object



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

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

#ldadda(rs, rt, rn) ⇒ Object



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

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

#ldaddab(rs, rt, rn) ⇒ Object



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

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

#ldaddah(rs, rt, rn) ⇒ Object



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

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

#ldaddal(rs, rt, rn) ⇒ Object



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

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

#ldaddalb(rs, rt, rn) ⇒ Object



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

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

#ldaddalh(rs, rt, rn) ⇒ Object



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

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

#ldaddb(rs, rt, rn) ⇒ Object



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

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

#ldaddh(rs, rt, rn) ⇒ Object



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

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

#ldaddl(rs, rt, rn) ⇒ Object



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

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

#ldaddlb(rs, rt, rn) ⇒ Object



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

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

#ldaddlh(rs, rt, rn) ⇒ Object



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

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

#ldapr(rt, rn) ⇒ Object



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

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

#ldaprb(rt, rn) ⇒ Object



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

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

#ldaprh(rt, rn) ⇒ Object



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

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

#ldapur(rt, rn) ⇒ Object



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

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

#ldapurb(rt, rn) ⇒ Object



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

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

#ldapurh(rt, rn) ⇒ Object



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

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

#ldapursb(rt, rn) ⇒ Object



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

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

#ldapursh(rt, rn) ⇒ Object



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

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

#ldapursw(rt, rn) ⇒ Object



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

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

#ldar(rt, rn) ⇒ Object



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

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

#ldarb(rt, rn) ⇒ Object



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

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

#ldarh(rt, rn) ⇒ Object



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

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

#ldaxp(rt1, rt2, xn) ⇒ Object



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

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

#ldaxr(rt1, xn) ⇒ Object



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

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

#ldaxrb(rt1, xn) ⇒ Object



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

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

#ldaxrh(rt1, xn) ⇒ Object



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

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

#ldclr(rs, rt, rn) ⇒ Object



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

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

#ldclra(rs, rt, rn) ⇒ Object



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

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

#ldclrab(rs, rt, rn) ⇒ Object



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

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

#ldclrah(rs, rt, rn) ⇒ Object



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

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

#ldclral(rs, rt, rn) ⇒ Object



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

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

#ldclralb(rs, rt, rn) ⇒ Object



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

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

#ldclralh(rs, rt, rn) ⇒ Object



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

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

#ldclrb(rs, rt, rn) ⇒ Object



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

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

#ldclrh(rs, rt, rn) ⇒ Object



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

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

#ldclrl(rs, rt, rn) ⇒ Object



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

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

#ldclrlb(rs, rt, rn) ⇒ Object



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

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

#ldclrlh(rs, rt, rn) ⇒ Object



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

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

#ldeor(rs, rt, rn) ⇒ Object



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

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

#ldeora(rs, rt, rn) ⇒ Object



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

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

#ldeorab(rs, rt, rn) ⇒ Object



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

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

#ldeorah(rs, rt, rn) ⇒ Object



1021
1022
1023
# File 'lib/aarch64.rb', line 1021

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

#ldeoral(rs, rt, rn) ⇒ Object



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

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

#ldeoralb(rs, rt, rn) ⇒ Object



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

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

#ldeoralh(rs, rt, rn) ⇒ Object



1025
1026
1027
# File 'lib/aarch64.rb', line 1025

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

#ldeorb(rs, rt, rn) ⇒ Object



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

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

#ldeorh(rs, rt, rn) ⇒ Object



1029
1030
1031
# File 'lib/aarch64.rb', line 1029

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

#ldeorl(rs, rt, rn) ⇒ Object



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

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

#ldeorlb(rs, rt, rn) ⇒ Object



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

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

#ldeorlh(rs, rt, rn) ⇒ Object



1033
1034
1035
# File 'lib/aarch64.rb', line 1033

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

#ldg(xt, xn) ⇒ Object



1037
1038
1039
# File 'lib/aarch64.rb', line 1037

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

#ldgm(xt, xn) ⇒ Object



1041
1042
1043
# File 'lib/aarch64.rb', line 1041

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

#ldlar(rt, rn) ⇒ Object



1045
1046
1047
# File 'lib/aarch64.rb', line 1045

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

#ldlarb(rt, rn) ⇒ Object



1049
1050
1051
# File 'lib/aarch64.rb', line 1049

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

#ldlarh(rt, rn) ⇒ Object



1053
1054
1055
# File 'lib/aarch64.rb', line 1053

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

#ldnp(rt1, rt2, rn) ⇒ Object



1057
1058
1059
1060
# File 'lib/aarch64.rb', line 1057

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



1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/aarch64.rb', line 1062

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



1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
# File 'lib/aarch64.rb', line 1080

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



1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
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
# File 'lib/aarch64.rb', line 1097

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 option.name
                 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
      if rn.integer?
        rn = wrap_offset_with_label rn
      end
      a LDR_lit_gen.new(rt, rn, rt.sf)
    end
  end
end

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



1153
1154
1155
1156
1157
# File 'lib/aarch64.rb', line 1153

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



1159
1160
1161
1162
1163
# File 'lib/aarch64.rb', line 1159

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



1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
# File 'lib/aarch64.rb', line 1165

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

        s = if option.shift?
          !!option.amount
        else
          false
        end
        a LDRB_reg.new(wt, xn, imm, s ? 1 : 0, val)
      else
        a LDRB_reg.new(wt, xn, imm, 0, 0b11)
      end
    end
  end
end

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



1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/aarch64.rb', line 1202

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

        s = if option.shift?
          !!option.amount
        else
          false
        end
        a LDRH_reg.new(wt, xn, imm, s ? 1 : 0, val)
      else
        a LDRH_reg.new(wt, xn, imm, 0, 0b11)
      end
    end
  end
end

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



1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
# File 'lib/aarch64.rb', line 1239

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



1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
# File 'lib/aarch64.rb', line 1272

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



1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/aarch64.rb', line 1304

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 || 0) / 2, val)
        else
          a LDRSW_reg.new(xt, xn, imm, 0, 0b11)
        end
      end
    else
      if xn.integer?
        xn = wrap_offset_with_label xn
      end
      a LDRSW_lit.new(xt, xn)
    end
  end
end

#ldset(rs, rt, rn) ⇒ Object



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

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

#ldseta(rs, rt, rn) ⇒ Object



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

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

#ldsetab(rs, rt, rn) ⇒ Object



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

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

#ldsetah(rs, rt, rn) ⇒ Object



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

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

#ldsetal(rs, rt, rn) ⇒ Object



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

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

#ldsetalb(rs, rt, rn) ⇒ Object



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

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

#ldsetalh(rs, rt, rn) ⇒ Object



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

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

#ldsetb(rs, rt, rn) ⇒ Object



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

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

#ldseth(rs, rt, rn) ⇒ Object



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

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

#ldsetl(rs, rt, rn) ⇒ Object



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

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

#ldsetlb(rs, rt, rn) ⇒ Object



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

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

#ldsetlh(rs, rt, rn) ⇒ Object



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

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

#ldsmax(rs, rt, rn) ⇒ Object



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

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

#ldsmaxa(rs, rt, rn) ⇒ Object



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

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

#ldsmaxab(rs, rt, rn) ⇒ Object



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

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

#ldsmaxah(rs, rt, rn) ⇒ Object



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

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

#ldsmaxal(rs, rt, rn) ⇒ Object



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

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

#ldsmaxalb(rs, rt, rn) ⇒ Object



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

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

#ldsmaxalh(rs, rt, rn) ⇒ Object



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

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

#ldsmaxb(rs, rt, rn) ⇒ Object



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

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

#ldsmaxh(rs, rt, rn) ⇒ Object



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

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

#ldsmaxl(rs, rt, rn) ⇒ Object



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

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

#ldsmaxlb(rs, rt, rn) ⇒ Object



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

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

#ldsmaxlh(rs, rt, rn) ⇒ Object



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

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

#ldsmin(rs, rt, rn) ⇒ Object



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

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

#ldsmina(rs, rt, rn) ⇒ Object



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

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

#ldsminab(rs, rt, rn) ⇒ Object



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

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

#ldsminah(rs, rt, rn) ⇒ Object



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

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

#ldsminal(rs, rt, rn) ⇒ Object



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

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

#ldsminalb(rs, rt, rn) ⇒ Object



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

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

#ldsminalh(rs, rt, rn) ⇒ Object



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

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

#ldsminb(rs, rt, rn) ⇒ Object



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

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

#ldsminh(rs, rt, rn) ⇒ Object



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

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

#ldsminl(rs, rt, rn) ⇒ Object



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

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

#ldsminlb(rs, rt, rn) ⇒ Object



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

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

#ldsminlh(rs, rt, rn) ⇒ Object



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

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

#ldtr(rt, rn) ⇒ Object



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

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

#ldtrb(rt, rn) ⇒ Object



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

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

#ldtrh(rt, rn) ⇒ Object



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

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

#ldtrsb(rt, rn) ⇒ Object



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

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

#ldtrsh(rt, rn) ⇒ Object



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

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

#ldtrsw(rt, rn) ⇒ Object



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

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

#ldumax(rs, rt, rn) ⇒ Object



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

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

#ldumaxa(rs, rt, rn) ⇒ Object



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

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

#ldumaxab(rs, rt, rn) ⇒ Object



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

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

#ldumaxah(rs, rt, rn) ⇒ Object



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

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

#ldumaxal(rs, rt, rn) ⇒ Object



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

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

#ldumaxalb(rs, rt, rn) ⇒ Object



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

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

#ldumaxalh(rs, rt, rn) ⇒ Object



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

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

#ldumaxb(rs, rt, rn) ⇒ Object



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

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

#ldumaxh(rs, rt, rn) ⇒ Object



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

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

#ldumaxl(rs, rt, rn) ⇒ Object



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

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

#ldumaxlb(rs, rt, rn) ⇒ Object



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

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

#ldumaxlh(rs, rt, rn) ⇒ Object



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

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

#ldumin(rs, rt, rn) ⇒ Object



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

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

#ldumina(rs, rt, rn) ⇒ Object



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

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

#lduminab(rs, rt, rn) ⇒ Object



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

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

#lduminah(rs, rt, rn) ⇒ Object



1590
1591
1592
# File 'lib/aarch64.rb', line 1590

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

#lduminal(rs, rt, rn) ⇒ Object



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

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

#lduminalb(rs, rt, rn) ⇒ Object



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

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

#lduminalh(rs, rt, rn) ⇒ Object



1594
1595
1596
# File 'lib/aarch64.rb', line 1594

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

#lduminb(rs, rt, rn) ⇒ Object



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

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

#lduminh(rs, rt, rn) ⇒ Object



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

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

#lduminl(rs, rt, rn) ⇒ Object



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

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

#lduminlb(rs, rt, rn) ⇒ Object



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

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

#lduminlh(rs, rt, rn) ⇒ Object



1602
1603
1604
# File 'lib/aarch64.rb', line 1602

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

#ldur(rt, rn) ⇒ Object



1622
1623
1624
# File 'lib/aarch64.rb', line 1622

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

#ldurb(rt, rn) ⇒ Object



1626
1627
1628
# File 'lib/aarch64.rb', line 1626

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

#ldurh(rt, rn) ⇒ Object



1630
1631
1632
# File 'lib/aarch64.rb', line 1630

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

#ldursb(rt, rn) ⇒ Object



1606
1607
1608
# File 'lib/aarch64.rb', line 1606

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

#ldursh(rt, rn) ⇒ Object



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

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

#ldursw(rt, rn) ⇒ Object



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

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

#ldxp(rt, rt2, rn) ⇒ Object



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

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

#ldxr(rt, rn) ⇒ Object



1634
1635
1636
# File 'lib/aarch64.rb', line 1634

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

#ldxrb(rt, rn) ⇒ Object



1638
1639
1640
# File 'lib/aarch64.rb', line 1638

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

#ldxrh(rt, rn) ⇒ Object



1642
1643
1644
# File 'lib/aarch64.rb', line 1642

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

#lsl(rd, rn, rm) ⇒ Object



1646
1647
1648
1649
1650
1651
1652
# File 'lib/aarch64.rb', line 1646

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



1654
1655
1656
# File 'lib/aarch64.rb', line 1654

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

#lsr(rd, rn, rm) ⇒ Object



1658
1659
1660
1661
1662
1663
1664
# File 'lib/aarch64.rb', line 1658

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



1666
1667
1668
# File 'lib/aarch64.rb', line 1666

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

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



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

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.



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

def make_label name
  Label.new name
end

#mneg(rd, rn, rm) ⇒ Object



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

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

#mov(rd, rm) ⇒ Object



1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
# File 'lib/aarch64.rb', line 1678

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



1725
1726
1727
1728
# File 'lib/aarch64.rb', line 1725

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



1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
# File 'lib/aarch64.rb', line 1703

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



1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
# File 'lib/aarch64.rb', line 1714

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



1730
1731
1732
1733
1734
1735
1736
1737
1738
# File 'lib/aarch64.rb', line 1730

def mrs rt, reg
  o0 = case reg.op0
       when 2 then 0
       when 3 then 1
       else
         raise
       end
  a MRS.new(o0, reg.op1, reg.CRn, reg.CRm, reg.op2, rt)
end

#msr(reg, rt) ⇒ Object



1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
# File 'lib/aarch64.rb', line 1740

def msr reg, rt
  if rt.integer?
    raise NotImplementedError
  else
    o0 = case reg.op0
         when 2 then 0
         when 3 then 1
         else
           raise
         end

    a MSR_reg.new(o0, reg.op1, reg.CRn, reg.CRm, reg.op2, rt)
  end
end

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



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

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

#mul(rd, rn, rm) ⇒ Object



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

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

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



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

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



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

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



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

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



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

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

#ngcs(rd, rm) ⇒ Object



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

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

#nopObject



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

def nop
  a NOP.new
end

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



1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
# File 'lib/aarch64.rb', line 1787

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



1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
# File 'lib/aarch64.rb', line 1798

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



1814
1815
1816
# File 'lib/aarch64.rb', line 1814

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

#pacdb(xd, xn) ⇒ Object



1822
1823
1824
# File 'lib/aarch64.rb', line 1822

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

#pacdza(xd) ⇒ Object



1818
1819
1820
# File 'lib/aarch64.rb', line 1818

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

#pacdzb(xd) ⇒ Object



1826
1827
1828
# File 'lib/aarch64.rb', line 1826

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

#pacga(xd, xn, xm) ⇒ Object



1830
1831
1832
# File 'lib/aarch64.rb', line 1830

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

#pacia(xd, xn) ⇒ Object



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

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

#pacia1716Object



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

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

#paciaspObject



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

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

#paciazObject



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

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

#pacib(xd, xn) ⇒ Object



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

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

#pacib1716Object



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

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

#pacibspObject



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

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

#pacibzObject



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

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

#paciza(xd) ⇒ Object



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

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

#pacizb(xd) ⇒ Object



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

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


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

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

#prfm(rt, xn) ⇒ Object



1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
# File 'lib/aarch64.rb', line 1874

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 option.name
              end
      a PRFM_reg.new(rt, xn, rm, shift, (option.amount || 0) / 3)
    end
  else
    if xn.integer?
      xn = wrap_offset_with_label xn
    end

    a PRFM_lit.new(rt, xn)
  end
end

#prfum(rt, rn) ⇒ Object



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

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



1911
1912
1913
# File 'lib/aarch64.rb', line 1911

def psb _
  a PSB.new
end

#pssbbObject



1915
1916
1917
# File 'lib/aarch64.rb', line 1915

def pssbb
  dsb 4
end

#put_label(label) ⇒ Object

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



174
175
176
177
# File 'lib/aarch64.rb', line 174

def put_label label
  label.set_offset(@insns.length * 4)
  self
end

#rbit(rd, rn) ⇒ Object



1919
1920
1921
# File 'lib/aarch64.rb', line 1919

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

#ret(reg = X30) ⇒ Object



1923
1924
1925
# File 'lib/aarch64.rb', line 1923

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

#retaaObject



1927
1928
1929
# File 'lib/aarch64.rb', line 1927

def retaa
  a RETA.new(0)
end

#retabObject



1931
1932
1933
# File 'lib/aarch64.rb', line 1931

def retab
  a RETA.new(1)
end

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



1935
1936
1937
# File 'lib/aarch64.rb', line 1935

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

#rev16(rd, rn) ⇒ Object



1939
1940
1941
# File 'lib/aarch64.rb', line 1939

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

#rev32(rd, rn) ⇒ Object



1943
1944
1945
# File 'lib/aarch64.rb', line 1943

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

#rmif(rn, shift, mask) ⇒ Object



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

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

#ror(rd, rs, shift) ⇒ Object



1953
1954
1955
1956
1957
1958
1959
# File 'lib/aarch64.rb', line 1953

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



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

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

#sbObject



1965
1966
1967
# File 'lib/aarch64.rb', line 1965

def sb
  a SB.new
end

#sbc(rd, rn, rm) ⇒ Object



1969
1970
1971
# File 'lib/aarch64.rb', line 1969

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

#sbcs(rd, rn, rm) ⇒ Object



1973
1974
1975
# File 'lib/aarch64.rb', line 1973

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

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



1977
1978
1979
# File 'lib/aarch64.rb', line 1977

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

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



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

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

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



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

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

#sdiv(rd, rn, rm) ⇒ Object



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

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

#setf16(rn) ⇒ Object



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

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

#setf8(rn) ⇒ Object



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

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

#sevObject



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

def sev
  a SEV.new
end

#sevlObject



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

def sevl
  a SEVL.new
end

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



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

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

#smc(imm) ⇒ Object



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

def smc imm
  a SMC.new(imm)
end

#smnegl(rd, rn, rm) ⇒ Object



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

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

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



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

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

#smulh(rd, rn, rm) ⇒ Object



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

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

#smull(rd, rn, rm) ⇒ Object



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

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

#ssbbObject



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

def ssbb
  dsb 0
end

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



2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
# File 'lib/aarch64.rb', line 2037

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



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

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

#st64bv(rs, rt, rn) ⇒ Object



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

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

#st64bv0(rs, rt, rn) ⇒ Object



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

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

#stadd(rs, rn) ⇒ Object



2064
2065
2066
# File 'lib/aarch64.rb', line 2064

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

#staddb(rs, rn) ⇒ Object



2072
2073
2074
# File 'lib/aarch64.rb', line 2072

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

#staddh(rs, rn) ⇒ Object



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

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

#staddl(rs, rn) ⇒ Object



2068
2069
2070
# File 'lib/aarch64.rb', line 2068

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

#staddlb(rs, rn) ⇒ Object



2076
2077
2078
# File 'lib/aarch64.rb', line 2076

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

#staddlh(rs, rn) ⇒ Object



2084
2085
2086
# File 'lib/aarch64.rb', line 2084

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

#stclr(rs, rn) ⇒ Object



2088
2089
2090
# File 'lib/aarch64.rb', line 2088

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

#stclrb(rs, rn) ⇒ Object



2096
2097
2098
# File 'lib/aarch64.rb', line 2096

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

#stclrh(rs, rn) ⇒ Object



2104
2105
2106
# File 'lib/aarch64.rb', line 2104

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

#stclrl(rs, rn) ⇒ Object



2092
2093
2094
# File 'lib/aarch64.rb', line 2092

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

#stclrlb(rs, rn) ⇒ Object



2100
2101
2102
# File 'lib/aarch64.rb', line 2100

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

#stclrlh(rs, rn) ⇒ Object



2108
2109
2110
# File 'lib/aarch64.rb', line 2108

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

#steor(rs, rn) ⇒ Object



2112
2113
2114
# File 'lib/aarch64.rb', line 2112

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

#steorb(rs, rn) ⇒ Object



2120
2121
2122
# File 'lib/aarch64.rb', line 2120

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

#steorh(rs, rn) ⇒ Object



2128
2129
2130
# File 'lib/aarch64.rb', line 2128

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

#steorl(rs, rn) ⇒ Object



2116
2117
2118
# File 'lib/aarch64.rb', line 2116

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

#steorlb(rs, rn) ⇒ Object



2124
2125
2126
# File 'lib/aarch64.rb', line 2124

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

#steorlh(rs, rn) ⇒ Object



2132
2133
2134
# File 'lib/aarch64.rb', line 2132

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

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



2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
# File 'lib/aarch64.rb', line 2136

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



2151
2152
2153
# File 'lib/aarch64.rb', line 2151

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

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



2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
# File 'lib/aarch64.rb', line 2155

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



2170
2171
2172
# File 'lib/aarch64.rb', line 2170

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

#stllrb(rt, rn) ⇒ Object



2174
2175
2176
# File 'lib/aarch64.rb', line 2174

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

#stllrh(rt, rn) ⇒ Object



2178
2179
2180
# File 'lib/aarch64.rb', line 2178

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

#stlr(rt, rn) ⇒ Object



2182
2183
2184
# File 'lib/aarch64.rb', line 2182

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

#stlrb(rt, rn) ⇒ Object



2186
2187
2188
# File 'lib/aarch64.rb', line 2186

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

#stlrh(rt, rn) ⇒ Object



2190
2191
2192
# File 'lib/aarch64.rb', line 2190

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

#stlur(rt, rn) ⇒ Object



2194
2195
2196
# File 'lib/aarch64.rb', line 2194

def stlur rt, rn
  a STLUR_gen.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#stlurb(rt, rn) ⇒ Object



2198
2199
2200
# File 'lib/aarch64.rb', line 2198

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

#stlurh(rt, rn) ⇒ Object



2202
2203
2204
# File 'lib/aarch64.rb', line 2202

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

#stlxp(rs, rt, rt2, rn) ⇒ Object



2206
2207
2208
# File 'lib/aarch64.rb', line 2206

def stlxp rs, rt, rt2, rn
  a STLXP.new(rs, rt, rt2, rn.first, rt.sz)
end

#stlxr(rs, rt, rn) ⇒ Object



2210
2211
2212
# File 'lib/aarch64.rb', line 2210

def stlxr rs, rt, rn
  a STLXR.new(rs, rt, rn.first, rt.sizeb)
end

#stlxrb(rs, rt, rn) ⇒ Object



2214
2215
2216
# File 'lib/aarch64.rb', line 2214

def stlxrb rs, rt, rn
  a STLXRB.new(rs, rt, rn.first)
end

#stlxrh(rs, rt, rn) ⇒ Object



2218
2219
2220
# File 'lib/aarch64.rb', line 2218

def stlxrh rs, rt, rn
  a STLXRH.new(rs, rt, rn.first)
end

#stnp(rt, rt2, rn) ⇒ Object



2222
2223
2224
# File 'lib/aarch64.rb', line 2222

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



2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
# File 'lib/aarch64.rb', line 2226

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



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
2269
2270
2271
2272
2273
2274
# File 'lib/aarch64.rb', line 2243

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 || 0) / (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



2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
# File 'lib/aarch64.rb', line 2276

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



2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
# File 'lib/aarch64.rb', line 2309

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) > 0 ? 1 : 0

      a STRH_reg.new(rt, rn, rm, extend, amount)
    end
  end
end

#stset(rs, rn) ⇒ Object



2342
2343
2344
# File 'lib/aarch64.rb', line 2342

def stset rs, rn
  ldset rs, rs.zr, rn
end

#stsetb(rs, rn) ⇒ Object



2350
2351
2352
# File 'lib/aarch64.rb', line 2350

def stsetb rs, rn
  ldsetb rs, rs.zr, rn
end

#stseth(rs, rn) ⇒ Object



2358
2359
2360
# File 'lib/aarch64.rb', line 2358

def stseth rs, rn
  ldseth rs, rs.zr, rn
end

#stsetl(rs, rn) ⇒ Object



2346
2347
2348
# File 'lib/aarch64.rb', line 2346

def stsetl rs, rn
  ldsetl rs, rs.zr, rn
end

#stsetlb(rs, rn) ⇒ Object



2354
2355
2356
# File 'lib/aarch64.rb', line 2354

def stsetlb rs, rn
  ldsetlb rs, rs.zr, rn
end

#stsetlh(rs, rn) ⇒ Object



2362
2363
2364
# File 'lib/aarch64.rb', line 2362

def stsetlh rs, rn
  ldsetlh rs, rs.zr, rn
end

#stsmax(rs, rn) ⇒ Object



2366
2367
2368
# File 'lib/aarch64.rb', line 2366

def stsmax rs, rn
  ldsmax rs, rs.zr, rn
end

#stsmaxb(rs, rn) ⇒ Object



2374
2375
2376
# File 'lib/aarch64.rb', line 2374

def stsmaxb rs, rn
  ldsmaxb rs, rs.zr, rn
end

#stsmaxh(rs, rn) ⇒ Object



2382
2383
2384
# File 'lib/aarch64.rb', line 2382

def stsmaxh rs, rn
  ldsmaxh rs, rs.zr, rn
end

#stsmaxl(rs, rn) ⇒ Object



2370
2371
2372
# File 'lib/aarch64.rb', line 2370

def stsmaxl rs, rn
  ldsmaxl rs, rs.zr, rn
end

#stsmaxlb(rs, rn) ⇒ Object



2378
2379
2380
# File 'lib/aarch64.rb', line 2378

def stsmaxlb rs, rn
  ldsmaxlb rs, rs.zr, rn
end

#stsmaxlh(rs, rn) ⇒ Object



2386
2387
2388
# File 'lib/aarch64.rb', line 2386

def stsmaxlh rs, rn
  ldsmaxlh rs, rs.zr, rn
end

#stsmin(rs, rn) ⇒ Object



2390
2391
2392
# File 'lib/aarch64.rb', line 2390

def stsmin rs, rn
  ldsmin rs, rs.zr, rn
end

#stsminb(rs, rn) ⇒ Object



2398
2399
2400
# File 'lib/aarch64.rb', line 2398

def stsminb rs, rn
  ldsminb rs, rs.zr, rn
end

#stsminh(rs, rn) ⇒ Object



2406
2407
2408
# File 'lib/aarch64.rb', line 2406

def stsminh rs, rn
  ldsminh rs, rs.zr, rn
end

#stsminl(rs, rn) ⇒ Object



2394
2395
2396
# File 'lib/aarch64.rb', line 2394

def stsminl rs, rn
  ldsminl rs, rs.zr, rn
end

#stsminlb(rs, rn) ⇒ Object



2402
2403
2404
# File 'lib/aarch64.rb', line 2402

def stsminlb rs, rn
  ldsminlb rs, rs.zr, rn
end

#stsminlh(rs, rn) ⇒ Object



2410
2411
2412
# File 'lib/aarch64.rb', line 2410

def stsminlh rs, rn
  ldsminlh rs, rs.zr, rn
end

#sttr(rt, rn) ⇒ Object



2414
2415
2416
# File 'lib/aarch64.rb', line 2414

def sttr rt, rn
  a STTR.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#sttrb(rt, rn) ⇒ Object



2418
2419
2420
# File 'lib/aarch64.rb', line 2418

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

#sttrh(rt, rn) ⇒ Object



2422
2423
2424
# File 'lib/aarch64.rb', line 2422

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

#stumax(rs, rn) ⇒ Object



2426
2427
2428
# File 'lib/aarch64.rb', line 2426

def stumax rs, rn
  ldumax rs, rs.zr, rn
end

#stumaxb(rs, rn) ⇒ Object



2434
2435
2436
# File 'lib/aarch64.rb', line 2434

def stumaxb rs, rn
  ldumaxb rs, rs.zr, rn
end

#stumaxh(rs, rn) ⇒ Object



2442
2443
2444
# File 'lib/aarch64.rb', line 2442

def stumaxh rs, rn
  ldumaxh rs, rs.zr, rn
end

#stumaxl(rs, rn) ⇒ Object



2430
2431
2432
# File 'lib/aarch64.rb', line 2430

def stumaxl rs, rn
  ldumaxl rs, rs.zr, rn
end

#stumaxlb(rs, rn) ⇒ Object



2438
2439
2440
# File 'lib/aarch64.rb', line 2438

def stumaxlb rs, rn
  ldumaxlb rs, rs.zr, rn
end

#stumaxlh(rs, rn) ⇒ Object



2446
2447
2448
# File 'lib/aarch64.rb', line 2446

def stumaxlh rs, rn
  ldumaxlh rs, rs.zr, rn
end

#stumin(rs, rn) ⇒ Object



2450
2451
2452
# File 'lib/aarch64.rb', line 2450

def stumin rs, rn
  ldumin rs, rs.zr, rn
end

#stuminb(rs, rn) ⇒ Object



2458
2459
2460
# File 'lib/aarch64.rb', line 2458

def stuminb rs, rn
  lduminb rs, rs.zr, rn
end

#stuminh(rs, rn) ⇒ Object



2466
2467
2468
# File 'lib/aarch64.rb', line 2466

def stuminh rs, rn
  lduminh rs, rs.zr, rn
end

#stuminl(rs, rn) ⇒ Object



2454
2455
2456
# File 'lib/aarch64.rb', line 2454

def stuminl rs, rn
  lduminl rs, rs.zr, rn
end

#stuminlb(rs, rn) ⇒ Object



2462
2463
2464
# File 'lib/aarch64.rb', line 2462

def stuminlb rs, rn
  lduminlb rs, rs.zr, rn
end

#stuminlh(rs, rn) ⇒ Object



2470
2471
2472
# File 'lib/aarch64.rb', line 2470

def stuminlh rs, rn
  lduminlh rs, rs.zr, rn
end

#stur(rt, rn) ⇒ Object



2474
2475
2476
# File 'lib/aarch64.rb', line 2474

def stur rt, rn
  a STUR_gen.new(rt, rn.first, rn[1] || 0, rt.sizeb)
end

#sturb(rt, rn) ⇒ Object



2478
2479
2480
# File 'lib/aarch64.rb', line 2478

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

#sturh(rt, rn) ⇒ Object



2482
2483
2484
# File 'lib/aarch64.rb', line 2482

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

#stxp(rs, rt1, rt2, rn) ⇒ Object



2486
2487
2488
# File 'lib/aarch64.rb', line 2486

def stxp rs, rt1, rt2, rn
  a STXP.new(rs, rt1, rt2, rn.first, rt1.sf)
end

#stxr(rs, rt, rn) ⇒ Object



2490
2491
2492
# File 'lib/aarch64.rb', line 2490

def stxr rs, rt, rn
  a STXR.new(rs, rt, rn.first, rt.opc2)
end

#stxrb(rs, rt, rn) ⇒ Object



2494
2495
2496
# File 'lib/aarch64.rb', line 2494

def stxrb rs, rt, rn
  a STXRB.new(rs, rt, rn.first)
end

#stxrh(rs, rt, rn) ⇒ Object



2498
2499
2500
# File 'lib/aarch64.rb', line 2498

def stxrh rs, rt, rn
  a STXRH.new(rs, rt, rn.first)
end

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



2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
# File 'lib/aarch64.rb', line 2502

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



2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
# File 'lib/aarch64.rb', line 2516

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



2530
2531
2532
# File 'lib/aarch64.rb', line 2530

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



2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
# File 'lib/aarch64.rb', line 2574

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 = if m.x?
               Utils.sub_decode_extend64(extend)
             else
               Utils.sub_decode_extend32(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 || 0) / 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)


2614
2615
2616
2617
# File 'lib/aarch64.rb', line 2614

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)


2619
2620
2621
2622
# File 'lib/aarch64.rb', line 2619

def subp xd, xn, xm
  raise NotImplementedError unless xd.x?
  a SUBP.new(xd, xn, xm)
end

#subps(xd, xn, xm) ⇒ Object

Raises:

  • (NotImplementedError)


2624
2625
2626
2627
# File 'lib/aarch64.rb', line 2624

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



2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
# File 'lib/aarch64.rb', line 2534

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 = if m.x?
               Utils.sub_decode_extend64(extend)
             else
               Utils.sub_decode_extend32(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



2629
2630
2631
# File 'lib/aarch64.rb', line 2629

def svc imm
  a SVC.new(imm)
end

#swp(rs, rt, rn) ⇒ Object



2633
2634
2635
# File 'lib/aarch64.rb', line 2633

def swp rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 0, 0)
end

#swpa(rs, rt, rn) ⇒ Object



2645
2646
2647
# File 'lib/aarch64.rb', line 2645

def swpa rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 1, 0)
end

#swpab(rs, rt, rn) ⇒ Object



2649
2650
2651
# File 'lib/aarch64.rb', line 2649

def swpab rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 1, 0)
end

#swpah(rs, rt, rn) ⇒ Object



2665
2666
2667
# File 'lib/aarch64.rb', line 2665

def swpah rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 1, 0)
end

#swpal(rs, rt, rn) ⇒ Object



2637
2638
2639
# File 'lib/aarch64.rb', line 2637

def swpal rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 1, 1)
end

#swpalb(rs, rt, rn) ⇒ Object



2653
2654
2655
# File 'lib/aarch64.rb', line 2653

def swpalb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 1, 1)
end

#swpalh(rs, rt, rn) ⇒ Object



2669
2670
2671
# File 'lib/aarch64.rb', line 2669

def swpalh rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 1, 1)
end

#swpb(rs, rt, rn) ⇒ Object



2657
2658
2659
# File 'lib/aarch64.rb', line 2657

def swpb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 0, 0)
end

#swph(rs, rt, rn) ⇒ Object



2673
2674
2675
# File 'lib/aarch64.rb', line 2673

def swph rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 0, 0)
end

#swpl(rs, rt, rn) ⇒ Object



2641
2642
2643
# File 'lib/aarch64.rb', line 2641

def swpl rs, rt, rn
  a SWP.new(rs, rt, rn.first, rs.opc2, 0, 1)
end

#swplb(rs, rt, rn) ⇒ Object



2661
2662
2663
# File 'lib/aarch64.rb', line 2661

def swplb rs, rt, rn
  a SWPB.new(rs, rt, rn.first, 0, 1)
end

#swplh(rs, rt, rn) ⇒ Object



2677
2678
2679
# File 'lib/aarch64.rb', line 2677

def swplh rs, rt, rn
  a SWPH.new(rs, rt, rn.first, 0, 1)
end

#sxtb(rd, rn) ⇒ Object



2681
2682
2683
# File 'lib/aarch64.rb', line 2681

def sxtb rd, rn
  sbfm rd, rn, 0, 7
end

#sxth(rd, rn) ⇒ Object



2685
2686
2687
# File 'lib/aarch64.rb', line 2685

def sxth rd, rn
  sbfm rd, rn, 0, 15
end

#sxtw(rd, rn) ⇒ Object



2689
2690
2691
# File 'lib/aarch64.rb', line 2689

def sxtw rd, rn
  sbfm rd, rn, 0, 31
end

#sys(op1, cn, cm, op2, xt = XZR) ⇒ Object



2693
2694
2695
# File 'lib/aarch64.rb', line 2693

def sys op1, cn, cm, op2, xt = XZR
  a SYS.new(op1, cn, cm, op2, xt)
end

#sysl(xt, op1, cn, cm, op2) ⇒ Object



2697
2698
2699
# File 'lib/aarch64.rb', line 2697

def sysl xt, op1, cn, cm, op2
  a SYSL.new(xt, op1, cn, cm, op2)
end

#tbnz(rt, imm, label) ⇒ Object



2701
2702
2703
2704
2705
2706
# File 'lib/aarch64.rb', line 2701

def tbnz rt, imm, label
  if label.integer?
    label = wrap_offset_with_label label
  end
  a TBNZ.new(rt, imm, label, rt.sf)
end

#tbz(rt, imm, label) ⇒ Object



2708
2709
2710
2711
2712
2713
# File 'lib/aarch64.rb', line 2708

def tbz rt, imm, label
  if label.integer?
    label = wrap_offset_with_label label
  end
  a TBZ.new(rt, imm, label, rt.sf)
end

#tlbi(tlbi_op, xt = XZR) ⇒ Object



2715
2716
2717
2718
# File 'lib/aarch64.rb', line 2715

def tlbi tlbi_op, xt = XZR
  op1, crm, op2 = Utils.tlbi_op(tlbi_op)
  sys op1, Names::C8, crm, op2, xt
end

#to_binaryObject



2821
2822
2823
# File 'lib/aarch64.rb', line 2821

def to_binary
  @insns.map(&:encode).pack("L<*")
end

#tsb(_) ⇒ Object



2720
2721
2722
# File 'lib/aarch64.rb', line 2720

def tsb _
  a TSB.new
end

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



2724
2725
2726
2727
2728
2729
2730
2731
# File 'lib/aarch64.rb', line 2724

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



2737
2738
2739
# File 'lib/aarch64.rb', line 2737

def ubfiz rd, rn, lsb, width
  ubfm rd, rn, (-lsb) % rd.size, width - 1
end

#ubfm(rd, rn, immr, imms) ⇒ Object



2733
2734
2735
# File 'lib/aarch64.rb', line 2733

def ubfm rd, rn, immr, imms
  a UBFM.new(rd, rn, immr, imms, rd.sf)
end

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



2741
2742
2743
# File 'lib/aarch64.rb', line 2741

def ubfx rd, rn, lsb, width
  ubfm rd, rn, lsb, lsb + width - 1
end

#udf(imm) ⇒ Object



2745
2746
2747
# File 'lib/aarch64.rb', line 2745

def udf imm
  a UDF_perm_undef.new(imm)
end

#udiv(rd, rn, rm) ⇒ Object



2749
2750
2751
# File 'lib/aarch64.rb', line 2749

def udiv rd, rn, rm
  a UDIV.new(rd, rn, rm, rd.sf)
end

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



2753
2754
2755
# File 'lib/aarch64.rb', line 2753

def umaddl xd, wn, wm, xa
  a UMADDL.new(xd, wn, wm, xa)
end

#umnegl(xd, wn, wm) ⇒ Object



2757
2758
2759
# File 'lib/aarch64.rb', line 2757

def umnegl xd, wn, wm
  umsubl xd, wn, wm, XZR
end

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



2761
2762
2763
# File 'lib/aarch64.rb', line 2761

def umsubl xd, wn, wm, xa
  a UMSUBL.new(xd, wn, wm, xa)
end

#umulh(rd, rn, rm) ⇒ Object



2765
2766
2767
# File 'lib/aarch64.rb', line 2765

def umulh rd, rn, rm
  a UMULH.new(rd, rn, rm)
end

#umull(xd, wn, wm) ⇒ Object



2769
2770
2771
# File 'lib/aarch64.rb', line 2769

def umull xd, wn, wm
  umaddl xd, wn, wm, XZR
end

#uxtb(rd, rn) ⇒ Object



2773
2774
2775
# File 'lib/aarch64.rb', line 2773

def uxtb rd, rn
  ubfm rd, rn, 0, 7
end

#uxth(rd, rn) ⇒ Object



2777
2778
2779
# File 'lib/aarch64.rb', line 2777

def uxth rd, rn
  ubfm rd, rn, 0, 15
end

#wfeObject



2781
2782
2783
# File 'lib/aarch64.rb', line 2781

def wfe
  a WFE.new
end

#wfet(rd) ⇒ Object



2785
2786
2787
# File 'lib/aarch64.rb', line 2785

def wfet rd
  a WFET.new(rd)
end

#wfiObject



2789
2790
2791
# File 'lib/aarch64.rb', line 2789

def wfi
  a WFI.new
end

#wfit(rd) ⇒ Object



2793
2794
2795
# File 'lib/aarch64.rb', line 2793

def wfit rd
  a WFIT.new(rd)
end

#write_to(io) ⇒ Object



2817
2818
2819
# File 'lib/aarch64.rb', line 2817

def write_to io
  io.write to_binary
end

#xaflagObject



2797
2798
2799
# File 'lib/aarch64.rb', line 2797

def xaflag
  a XAFLAG.new
end

#xpacd(rd) ⇒ Object



2801
2802
2803
# File 'lib/aarch64.rb', line 2801

def xpacd rd
  a XPAC.new(rd, 1)
end

#xpaci(rd) ⇒ Object



2805
2806
2807
# File 'lib/aarch64.rb', line 2805

def xpaci rd
  a XPAC.new(rd, 0)
end

#xpaclriObject



2809
2810
2811
# File 'lib/aarch64.rb', line 2809

def xpaclri
  a XPACLRI.new
end

#yieldObject



2813
2814
2815
# File 'lib/aarch64.rb', line 2813

def yield
  a YIELD.new
end