pred.isa (8304:16911ff780d3) pred.isa (11320:42ecb523c64a)
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

--- 27 unchanged lines hidden (view full) ---

36// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40//
41// Authors: Stephen Hines
42
43let {{
1// -*- mode:c++ -*-
2
3// Copyright (c) 2010 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating

--- 27 unchanged lines hidden (view full) ---

36// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40//
41// Authors: Stephen Hines
42
43let {{
44
44
45 calcCcCode = '''
46 if (%(canOverflow)s){
47 cprintf("canOverflow: %%d\\n", Rd < resTemp);
48 CpsrQ = (Rd < resTemp) ? 1 << 27 : 0;
49 } else {
50 uint16_t _ic, _iv, _iz, _in;
51 _in = (resTemp >> %(negBit)d);
52 _iz = (resTemp == 0);
53 _iv = %(ivValue)s;
54 _ic = %(icValue)s;
45 calcCcCode = '''
46 if (%(canOverflow)s){
47 cprintf("canOverflow: %%d\\n", Rd < resTemp);
48 CpsrQ = (Rd < resTemp) ? 1 << 27 : 0;
49 } else {
50 uint16_t _ic, _iv, _iz, _in;
51 _in = (resTemp >> %(negBit)d);
52 _iz = (resTemp == 0);
53 _iv = %(ivValue)s;
54 _ic = %(icValue)s;
55
55
56 CondCodesNZ = (_in << 1) | (_iz);
57 CondCodesC = _ic;
58 CondCodesV = _iv;
59
60 DPRINTF(Arm, "in = %%d\\n", _in);
61 DPRINTF(Arm, "iz = %%d\\n", _iz);
62 DPRINTF(Arm, "ic = %%d\\n", _ic);
63 DPRINTF(Arm, "iv = %%d\\n", _iv);

--- 10 unchanged lines hidden (view full) ---

74 if flagtype == "none":
75 icReg = icImm = 'CondCodesC'
76 iv = 'CondCodesV'
77 elif flagtype == "llbit":
78 icReg = icImm = 'CondCodesC'
79 iv = 'CondCodesV'
80 negBit = 63
81 elif flagtype == "overflow":
56 CondCodesNZ = (_in << 1) | (_iz);
57 CondCodesC = _ic;
58 CondCodesV = _iv;
59
60 DPRINTF(Arm, "in = %%d\\n", _in);
61 DPRINTF(Arm, "iz = %%d\\n", _iz);
62 DPRINTF(Arm, "ic = %%d\\n", _ic);
63 DPRINTF(Arm, "iv = %%d\\n", _iv);

--- 10 unchanged lines hidden (view full) ---

74 if flagtype == "none":
75 icReg = icImm = 'CondCodesC'
76 iv = 'CondCodesV'
77 elif flagtype == "llbit":
78 icReg = icImm = 'CondCodesC'
79 iv = 'CondCodesV'
80 negBit = 63
81 elif flagtype == "overflow":
82 canOverflow = "true"
82 canOverflow = "true"
83 icReg = icImm = iv = '0'
84 elif flagtype == "add":
85 icReg = icImm = 'findCarry(32, resTemp, Rn, op2)'
86 iv = 'findOverflow(32, resTemp, Rn, op2)'
87 elif flagtype == "sub":
88 icReg = icImm ='findCarry(32, resTemp, Rn, ~op2)'
89 iv = 'findOverflow(32, resTemp, Rn, ~op2)'
90 elif flagtype == "rsb":
91 icReg = icImm = 'findCarry(32, resTemp, op2, ~Rn)'
92 iv = 'findOverflow(32, resTemp, op2, ~Rn)'
93 else:
94 icReg = 'shift_carry_rs(Rm, Rs<7:0>, shift, CondCodesC)'
95 icImm = 'shift_carry_imm(Rm, shift_size, shift, CondCodesC)'
96 iv = 'CondCodesV'
83 icReg = icImm = iv = '0'
84 elif flagtype == "add":
85 icReg = icImm = 'findCarry(32, resTemp, Rn, op2)'
86 iv = 'findOverflow(32, resTemp, Rn, op2)'
87 elif flagtype == "sub":
88 icReg = icImm ='findCarry(32, resTemp, Rn, ~op2)'
89 iv = 'findOverflow(32, resTemp, Rn, ~op2)'
90 elif flagtype == "rsb":
91 icReg = icImm = 'findCarry(32, resTemp, op2, ~Rn)'
92 iv = 'findOverflow(32, resTemp, op2, ~Rn)'
93 else:
94 icReg = 'shift_carry_rs(Rm, Rs<7:0>, shift, CondCodesC)'
95 icImm = 'shift_carry_imm(Rm, shift_size, shift, CondCodesC)'
96 iv = 'CondCodesV'
97 return (calcCcCode % {"icValue" : icReg,
98 "ivValue" : iv,
97 return (calcCcCode % {"icValue" : icReg,
98 "ivValue" : iv,
99 "negBit" : negBit,
100 "canOverflow" : canOverflow },
99 "negBit" : negBit,
100 "canOverflow" : canOverflow },
101 calcCcCode % {"icValue" : icImm,
102 "ivValue" : iv,
101 calcCcCode % {"icValue" : icImm,
102 "ivValue" : iv,
103 "negBit" : negBit,
104 "canOverflow" : canOverflow })
105
106 def getImmCcCode(flagtype):
107 ivValue = icValue = ''
108 negBit = 31
109 canOverflow = 'false'
110 if flagtype == "none":
111 icValue = 'CondCodesC'
112 ivValue = 'CondCodesV'
113 elif flagtype == "llbit":
114 icValue = 'CondCodesC'
115 ivValue = 'CondCodesV'
116 negBit = 63
117 elif flagtype == "overflow":
118 icVaule = ivValue = '0'
103 "negBit" : negBit,
104 "canOverflow" : canOverflow })
105
106 def getImmCcCode(flagtype):
107 ivValue = icValue = ''
108 negBit = 31
109 canOverflow = 'false'
110 if flagtype == "none":
111 icValue = 'CondCodesC'
112 ivValue = 'CondCodesV'
113 elif flagtype == "llbit":
114 icValue = 'CondCodesC'
115 ivValue = 'CondCodesV'
116 negBit = 63
117 elif flagtype == "overflow":
118 icVaule = ivValue = '0'
119 canOverflow = "true"
119 canOverflow = "true"
120 elif flagtype == "add":
121 icValue = 'findCarry(32, resTemp, Rn, rotated_imm)'
122 ivValue = 'findOverflow(32, resTemp, Rn, rotated_imm)'
123 elif flagtype == "sub":
124 icValue = 'findCarry(32, resTemp, Rn, ~rotated_imm)'
125 ivValue = 'findOverflow(32, resTemp, Rn, ~rotated_imm)'
126 elif flagtype == "rsb":
127 icValue = 'findCarry(32, resTemp, rotated_imm, ~Rn)'

--- 84 unchanged lines hidden ---
120 elif flagtype == "add":
121 icValue = 'findCarry(32, resTemp, Rn, rotated_imm)'
122 ivValue = 'findOverflow(32, resTemp, Rn, rotated_imm)'
123 elif flagtype == "sub":
124 icValue = 'findCarry(32, resTemp, Rn, ~rotated_imm)'
125 ivValue = 'findOverflow(32, resTemp, Rn, ~rotated_imm)'
126 elif flagtype == "rsb":
127 icValue = 'findCarry(32, resTemp, rotated_imm, ~Rn)'

--- 84 unchanged lines hidden ---