~vcs-imports/qemu/git

« back to all changes in this revision

Viewing changes to target-arm/op_addsub.h

  • Committer: pbrook
  • Date: 2006-10-22 00:18:54 UTC
  • Revision ID: git-v1:e6e5906b6e0a81718066ca43aef57515026c6624
ColdFire target.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2196 c046a42c-6fe2-441c-8c8c-71466251a162

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * ARMv6 integer SIMD operations.
3
 
 *
4
 
 * Copyright (c) 2007 CodeSourcery.
5
 
 * Written by Paul Brook
6
 
 *
7
 
 * This code is licenced under the GPL.
8
 
 */
9
 
 
10
 
#ifdef ARITH_GE
11
 
#define GE_ARG , uint32_t *gep
12
 
#define DECLARE_GE uint32_t ge = 0
13
 
#define SET_GE *gep = ge
14
 
#else
15
 
#define GE_ARG
16
 
#define DECLARE_GE do{}while(0)
17
 
#define SET_GE do{}while(0)
18
 
#endif
19
 
 
20
 
#define RESULT(val, n, width) \
21
 
    res |= ((uint32_t)(glue(glue(uint,width),_t))(val)) << (n * width)
22
 
 
23
 
uint32_t HELPER(glue(PFX,add16))(uint32_t a, uint32_t b GE_ARG)
24
 
{
25
 
    uint32_t res = 0;
26
 
    DECLARE_GE;
27
 
 
28
 
    ADD16(a, b, 0);
29
 
    ADD16(a >> 16, b >> 16, 1);
30
 
    SET_GE;
31
 
    return res;
32
 
}
33
 
 
34
 
uint32_t HELPER(glue(PFX,add8))(uint32_t a, uint32_t b GE_ARG)
35
 
{
36
 
    uint32_t res = 0;
37
 
    DECLARE_GE;
38
 
 
39
 
    ADD8(a, b, 0);
40
 
    ADD8(a >> 8, b >> 8, 1);
41
 
    ADD8(a >> 16, b >> 16, 2);
42
 
    ADD8(a >> 24, b >> 24, 3);
43
 
    SET_GE;
44
 
    return res;
45
 
}
46
 
 
47
 
uint32_t HELPER(glue(PFX,sub16))(uint32_t a, uint32_t b GE_ARG)
48
 
{
49
 
    uint32_t res = 0;
50
 
    DECLARE_GE;
51
 
 
52
 
    SUB16(a, b, 0);
53
 
    SUB16(a >> 16, b >> 16, 1);
54
 
    SET_GE;
55
 
    return res;
56
 
}
57
 
 
58
 
uint32_t HELPER(glue(PFX,sub8))(uint32_t a, uint32_t b GE_ARG)
59
 
{
60
 
    uint32_t res = 0;
61
 
    DECLARE_GE;
62
 
 
63
 
    SUB8(a, b, 0);
64
 
    SUB8(a >> 8, b >> 8, 1);
65
 
    SUB8(a >> 16, b >> 16, 2);
66
 
    SUB8(a >> 24, b >> 24, 3);
67
 
    SET_GE;
68
 
    return res;
69
 
}
70
 
 
71
 
uint32_t HELPER(glue(PFX,subaddx))(uint32_t a, uint32_t b GE_ARG)
72
 
{
73
 
    uint32_t res = 0;
74
 
    DECLARE_GE;
75
 
 
76
 
    ADD16(a, b, 0);
77
 
    SUB16(a >> 16, b >> 16, 1);
78
 
    SET_GE;
79
 
    return res;
80
 
}
81
 
 
82
 
uint32_t HELPER(glue(PFX,addsubx))(uint32_t a, uint32_t b GE_ARG)
83
 
{
84
 
    uint32_t res = 0;
85
 
    DECLARE_GE;
86
 
 
87
 
    SUB16(a, b, 0);
88
 
    ADD16(a >> 16, b >> 16, 1);
89
 
    SET_GE;
90
 
    return res;
91
 
}
92
 
 
93
 
#undef GE_ARG
94
 
#undef DECLARE_GE
95
 
#undef SET_GE
96
 
#undef RESULT
97
 
 
98
 
#undef ARITH_GE
99
 
#undef PFX
100
 
#undef ADD16
101
 
#undef SUB16
102
 
#undef ADD8
103
 
#undef SUB8