11f15402Robert Mustacchi/*
21f15402Robert Mustacchi * This file and its contents are supplied under the terms of the
31f15402Robert Mustacchi * Common Development and Distribution License ("CDDL"), version 1.0.
41f15402Robert Mustacchi * You may only use this file in accordance with the terms of version
51f15402Robert Mustacchi * 1.0 of the CDDL.
61f15402Robert Mustacchi *
71f15402Robert Mustacchi * A full copy of the text of the CDDL should have accompanied this
81f15402Robert Mustacchi * source.  A copy of the CDDL is also available via the Internet at
91f15402Robert Mustacchi * http://www.illumos.org/license/CDDL.
101f15402Robert Mustacchi */
111f15402Robert Mustacchi
121f15402Robert Mustacchi/*
131f15402Robert Mustacchi * Copyright 2018, Joyent, Inc.
141f15402Robert Mustacchi */
151f15402Robert Mustacchi
161f15402Robert Mustacchi/*
171f15402Robert Mustacchi * Test our disassembly of the RV32I instructions. Instructions are ordered per
181f15402Robert Mustacchi * the ISA manual. Supervisor and CSR instructions are elsewhere.
191f15402Robert Mustacchi */
201f15402Robert Mustacchi
211f15402Robert Mustacchi.text
221f15402Robert Mustacchi.align 16
231f15402Robert Mustacchi.globl libdis_test
241f15402Robert Mustacchi.type libdis_test, @function
251f15402Robert Mustacchilibdis_test:
261f15402Robert Mustacchi	lui	ra, 0x00
271f15402Robert Mustacchi	lui	ra, 0x23
281f15402Robert Mustacchi	lui	ra, 0xfffff
291f15402Robert Mustacchi	auipc	ra, 0x00
301f15402Robert Mustacchi	auipc	ra, 0x23
311f15402Robert Mustacchi	auipc	ra, 0xfffff
321f15402Robert Mustacchi	/*
331f15402Robert Mustacchi	 * Branches are not tested at this time as they basially always end up
341f15402Robert Mustacchi	 * wanting to create which ends up not really lending itself to
351f15402Robert Mustacchi	 * automated testing here.
361f15402Robert Mustacchi	 */
371f15402Robert Mustacchi	lb	s0, 0x7ff(s1)
381f15402Robert Mustacchi	lb	s1, (s1)
391f15402Robert Mustacchi	lb	s2, -0x800(s1)
401f15402Robert Mustacchi	lh	s3, 0x7ff(s1)
411f15402Robert Mustacchi	lh	s4, (s1)
421f15402Robert Mustacchi	lh	s5, -0x800(s1)
431f15402Robert Mustacchi	lw	s6, 0x7ff(s1)
441f15402Robert Mustacchi	lw	s7, (s1)
451f15402Robert Mustacchi	lw	s8, -0x800(s1)
461f15402Robert Mustacchi	lbu	s7, 0x7ff(s1)
471f15402Robert Mustacchi	lbu	s6, (s1)
481f15402Robert Mustacchi	lbu	s5, -0x800(s1)
491f15402Robert Mustacchi	lhu	s4, 0x7ff(s1)
501f15402Robert Mustacchi	lhu	s3, (s1)
511f15402Robert Mustacchi	lhu	s2, -0x800(s1)
521f15402Robert Mustacchi	sb	t0, 0x7ff(t1)
531f15402Robert Mustacchi	sb	t1, (t2)
541f15402Robert Mustacchi	sb	t2, -0x800(t3)
551f15402Robert Mustacchi	sh	t3, 0x7ff(t1)
561f15402Robert Mustacchi	sh	t4, (t2)
571f15402Robert Mustacchi	sh	t5, -0x800(t3)
581f15402Robert Mustacchi	sw	t4, 0x7ff(t1)
591f15402Robert Mustacchi	sw	t3, (t2)
601f15402Robert Mustacchi	sw	t2, -0x800(t3)
611f15402Robert Mustacchi	addi	ra, t0, 0x4
621f15402Robert Mustacchi	addi	ra, t0, -0x4
631f15402Robert Mustacchi	slti	ra, t0, 0x4
641f15402Robert Mustacchi	slti	ra, t0, -0x4
651f15402Robert Mustacchi	sltiu	ra, t0, 0x4
661f15402Robert Mustacchi	sltiu	ra, t0, -0x4
671f15402Robert Mustacchi	xori	ra, t0, 0x4
681f15402Robert Mustacchi	xori	ra, t0, -0x4
691f15402Robert Mustacchi	ori	ra, t0, 0x4
701f15402Robert Mustacchi	ori	ra, t0, -0x4
711f15402Robert Mustacchi	andi	ra, t0, 0x4
721f15402Robert Mustacchi	andi	ra, t0, -0x4
731f15402Robert Mustacchi	slli	t4, t5, 0x12
741f15402Robert Mustacchi	srli	t4, t5, 0x13
751f15402Robert Mustacchi	srai	t4, t5, 0x14
761f15402Robert Mustacchi	add	s0, s1, s2
771f15402Robert Mustacchi	sub	s1, s2, s3
781f15402Robert Mustacchi	sll	s3, s4, s5
791f15402Robert Mustacchi	slt	s4, s5, s6
801f15402Robert Mustacchi	sltu	a0, a1, ra
811f15402Robert Mustacchi	xor	s5, s6, s7
821f15402Robert Mustacchi	srl	s6, s7, s8
831f15402Robert Mustacchi	sra	s7, s8, s9
841f15402Robert Mustacchi	or	s8, s9, s10
851f15402Robert Mustacchi	and	s9, s10, s11
861f15402Robert Mustacchi	fence
871f15402Robert Mustacchi	fence	ow, ir
881f15402Robert Mustacchi	fence	ir, ow
891f15402Robert Mustacchi	fence	ior, iorw
901f15402Robert Mustacchi	fence.i
911f15402Robert Mustacchi.size libdis_test, [.-libdis_test]
92