aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite/aarch64/sumulh.s
blob: d75e0c64e1d991240b7d9c5778474a59c93fe987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# mach: aarch64

# Check the multiply highpart instructions: smulh, umulh.

# Test -2*2, -1<<32*-1<<32, -2*-2, and 2*2.

.include "testutils.inc"

	start

	mov x0, #-2
	mov x1, #2
	smulh x2, x0, x1
	cmp x2, #-1
	bne .Lfailure
	umulh x3, x0, x1
	cmp x3, #1
	bne .Lfailure

	mov w0, #-1
	lsl x0, x0, #32 // 0xffffffff00000000
	mov x1, x0
	smulh x2, x0, x1
	cmp x2, #1
	bne .Lfailure
	umulh x3, x0, x1
	mov w4, #-2
	lsl x4, x4, #32
	add x4, x4, #1  // 0xfffffffe00000001
	cmp x3, x4
	bne .Lfailure

	mov x0, #-2
	mov x1, #-2
	smulh x2, x0, x1
	cmp x2, #0
	bne .Lfailure
	umulh x3, x0, x1
	cmp x3, #-4
	bne .Lfailure

	mov x0, #2
	mov x1, #2
	smulh x2, x0, x1
	cmp x2, #0
	bne .Lfailure
	umulh x3, x0, x1
	cmp x3, #0
	bne .Lfailure

	pass
.Lfailure:
	fail