xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/aarch64/sumulh.s (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1# mach: aarch64
2
3# Check the multiply highpart instructions: smulh, umulh.
4
5# Test -2*2, -1<<32*-1<<32, -2*-2, and 2*2.
6
7.include "testutils.inc"
8
9	start
10
11	mov x0, #-2
12	mov x1, #2
13	smulh x2, x0, x1
14	cmp x2, #-1
15	bne .Lfailure
16	umulh x3, x0, x1
17	cmp x3, #1
18	bne .Lfailure
19
20	mov w0, #-1
21	lsl x0, x0, #32 // 0xffffffff00000000
22	mov x1, x0
23	smulh x2, x0, x1
24	cmp x2, #1
25	bne .Lfailure
26	umulh x3, x0, x1
27	mov w4, #-2
28	lsl x4, x4, #32
29	add x4, x4, #1  // 0xfffffffe00000001
30	cmp x3, x4
31	bne .Lfailure
32
33	mov x0, #-2
34	mov x1, #-2
35	smulh x2, x0, x1
36	cmp x2, #0
37	bne .Lfailure
38	umulh x3, x0, x1
39	cmp x3, #-4
40	bne .Lfailure
41
42	mov x0, #2
43	mov x1, #2
44	smulh x2, x0, x1
45	cmp x2, #0
46	bne .Lfailure
47	umulh x3, x0, x1
48	cmp x3, #0
49	bne .Lfailure
50
51	pass
52.Lfailure:
53	fail
54