Raymond Toy pushed to branch issue-249-replace-lea-in-arith at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/compiler/x86/arith.lisp
    ... ... @@ -196,118 +196,13 @@
    196 196
     
    
    197 197
     
    
    198 198
     
    
    199
    -;(define-binop + 4 add)
    
    199
    +(define-binop + 4 add)
    
    200 200
     (define-binop - 4 sub)
    
    201 201
     (define-binop logand 2 and)
    
    202 202
     (define-binop logior 2 or)
    
    203 203
     (define-binop logxor 2 xor)
    
    204 204
     
    
    205 205
     
    
    206
    -;;; Special handling of add on the x86; can use lea to avoid a
    
    207
    -;;; register load, otherwise it uses add.
    
    208
    -(define-vop (fast-+/fixnum=>fixnum fast-safe-arith-op)
    
    209
    -  (:translate +)
    
    210
    -  (:args (x :scs (any-reg) :target r
    
    211
    -	    :load-if (not (and (sc-is x control-stack)
    
    212
    -			       (sc-is y any-reg)
    
    213
    -			       (sc-is r control-stack)
    
    214
    -			       (location= x r))))
    
    215
    -	 (y :scs (any-reg control-stack)))
    
    216
    -  (:arg-types tagged-num tagged-num)
    
    217
    -  (:results (r :scs (any-reg) :from (:argument 0)
    
    218
    -	       :load-if (not (and (sc-is x control-stack)
    
    219
    -				  (sc-is y any-reg)
    
    220
    -				  (sc-is r control-stack)
    
    221
    -				  (location= x r)))))
    
    222
    -  (:result-types tagged-num)
    
    223
    -  (:note _N"inline fixnum arithmetic")
    
    224
    -  (:generator 2
    
    225
    -    (move r x)
    
    226
    -    (inst add r y)))
    
    227
    -
    
    228
    -(define-vop (fast-+-c/fixnum=>fixnum fast-safe-arith-op)
    
    229
    -  (:translate +)
    
    230
    -  (:args (x :target r :scs (any-reg control-stack)))
    
    231
    -  (:info y)
    
    232
    -  (:arg-types tagged-num (:constant (signed-byte 30)))
    
    233
    -  (:results (r :scs (any-reg)
    
    234
    -	       :load-if (not (location= x r))))
    
    235
    -  (:result-types tagged-num)
    
    236
    -  (:note _N"inline fixnum arithmetic")
    
    237
    -  (:generator 1
    
    238
    -    (move r x)
    
    239
    -    (inst add r (fixnumize y))))
    
    240
    -
    
    241
    -(define-vop (fast-+/signed=>signed fast-safe-arith-op)
    
    242
    -  (:translate +)
    
    243
    -  (:args (x :scs (signed-reg) :target r
    
    244
    -	    :load-if (not (and (sc-is x signed-stack)
    
    245
    -			       (sc-is y signed-reg)
    
    246
    -			       (sc-is r signed-stack)
    
    247
    -			       (location= x r))))
    
    248
    -	 (y :scs (signed-reg signed-stack)))
    
    249
    -  (:arg-types signed-num signed-num)
    
    250
    -  (:results (r :scs (signed-reg) :from (:argument 0)
    
    251
    -	       :load-if (not (and (sc-is x signed-stack)
    
    252
    -				  (sc-is y signed-reg)
    
    253
    -				  (location= x r)))))
    
    254
    -  (:result-types signed-num)
    
    255
    -  (:note _N"inline (signed-byte 32) arithmetic")
    
    256
    -  (:generator 5
    
    257
    -    (move r x)
    
    258
    -    (inst add r y)))
    
    259
    -
    
    260
    -(define-vop (fast-+-c/signed=>signed fast-safe-arith-op)
    
    261
    -  (:translate +)
    
    262
    -  (:args (x :target r :scs (signed-reg signed-stack)))
    
    263
    -  (:info y)
    
    264
    -  (:arg-types signed-num (:constant (signed-byte 32)))
    
    265
    -  (:results (r :scs (signed-reg)
    
    266
    -	       :load-if (not (location= x r))))
    
    267
    -  (:result-types signed-num)
    
    268
    -  (:note _N"inline (signed-byte 32) arithmetic")
    
    269
    -  (:generator 4
    
    270
    -    (move r x)
    
    271
    -    (if (= y 1)
    
    272
    -	(inst inc r)
    
    273
    -	(inst add r y))))
    
    274
    -
    
    275
    -(define-vop (fast-+/unsigned=>unsigned fast-safe-arith-op)
    
    276
    -  (:translate +)
    
    277
    -  (:args (x :scs (unsigned-reg) :target r
    
    278
    -	    :load-if (not (and (sc-is x unsigned-stack)
    
    279
    -			       (sc-is y unsigned-reg)
    
    280
    -			       (sc-is r unsigned-stack)
    
    281
    -			       (location= x r))))
    
    282
    -	 (y :scs (unsigned-reg unsigned-stack)))
    
    283
    -  (:arg-types unsigned-num unsigned-num)
    
    284
    -  (:results (r :scs (unsigned-reg) :from (:argument 0)
    
    285
    -	       :load-if (not (and (sc-is x unsigned-stack)
    
    286
    -				  (sc-is y unsigned-reg)
    
    287
    -				  (sc-is r unsigned-stack)
    
    288
    -				  (location= x r)))))
    
    289
    -  (:result-types unsigned-num)
    
    290
    -  (:note _N"inline (unsigned-byte 32) arithmetic")
    
    291
    -  (:generator 5
    
    292
    -    (move r x)
    
    293
    -    (inst add r y)))
    
    294
    -
    
    295
    -(define-vop (fast-+-c/unsigned=>unsigned fast-safe-arith-op)
    
    296
    -  (:translate +)
    
    297
    -  (:args (x :target r :scs (unsigned-reg unsigned-stack)))
    
    298
    -  (:info y)
    
    299
    -  (:arg-types unsigned-num (:constant (unsigned-byte 32)))
    
    300
    -  (:results (r :scs (unsigned-reg)
    
    301
    -	       :load-if (not (location= x r))))
    
    302
    -  (:result-types unsigned-num)
    
    303
    -  (:note _N"inline (unsigned-byte 32) arithmetic")
    
    304
    -  (:generator 4
    
    305
    -    (move r x)
    
    306
    -    (if (= y 1)
    
    307
    -	(inst inc r)
    
    308
    -	(inst add r y))))
    
    309
    -
    
    310
    -
    
    311 206
     ;;;; Special logand cases: (logand signed unsigned) => unsigned
    
    312 207
     
    
    313 208
     (define-vop (fast-logand/signed-unsigned=>unsigned