7aacc41871aaa5a4ac7adceb46f615e127eb88d8
[deliverable/binutils-gdb.git] / sim / testsuite / pru / mul.s
1 # Check that multiplication works.
2 # mach: pru
3
4 # Copyright (C) 2016-2021 Free Software Foundation, Inc.
5 # Contributed by Dimitar Dimitrov <dimitar@dinux.eu>
6 #
7 # This file is part of the GNU simulators.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 .include "testutils.inc"
23
24 start
25
26 # MUL: Test regular case
27 ldi r28, 1001
28 ldi r29, 4567
29 nop
30 xin 0, r26, 4
31 qbne32 2f, r26, 1001 * 4567
32
33 # MUL: Test the pipeline emulation
34 ldi r28, 1002
35 ldi r29, 1003
36 ldi r29, 4004
37 xin 0, r26, 4
38 qbne32 2f, r26, 1002 * 1003
39 xin 0, r26, 4
40 qbne32 2f, r26, 1002 * 4004
41
42 # MUL: Test 64-bit result
43 ldi32 r28, 0x12345678
44 ldi32 r29, 0xaabbccdd
45 nop
46 xin 0, r26, 8
47 qbne32 2f, r26, 0x45BE4598
48 qbne32 2f, r27, 0xC241C38
49
50 # MAC: Test regular case
51 ldi r25, 1
52 xout 0, r25, 1
53 ldi r25, 3
54 xout 0, r25, 1
55
56 ldi r25, 1
57 ldi r28, 1001
58 ldi r29, 2002
59 xout 0, r25, 1
60 ldi r28, 3003
61 ldi r29, 4004
62 xout 0, r25, 1
63
64 xin 0, r26, 4
65 qbne32 2f, r26, (1001 * 2002) + (3003 * 4004)
66
67 # MAC: Test 64-bit result
68 ldi r25, 3
69 xout 0, r25, 1
70
71 ldi r25, 1
72 ldi32 r28, 0x10203040
73 ldi32 r29, 0x50607080
74 xout 0, r25, 1
75 ldi32 r28, 0xa0b0c0d0
76 ldi32 r29, 0x11223344
77 xout 0, r25, 1
78
79 xin 0, r26, 8
80 qbne32 2f, r26, 0x8E30C740
81 qbne32 2f, r27, 0xFD156B1
82
83 jmp 1f
84
85 fail
86
87 1:
88 pass
89 2: fail
This page took 0.032921 seconds and 3 git commands to generate.