Let OFFSET-CONFLICTS-IN-SB check multiple offsets at a time
[sbcl.git] / src / compiler / x86 / array.lisp
index b4a49f4..ecd91fd 100644 (file)
   (def-full-data-vector-frobs simple-vector * descriptor-reg any-reg)
   (def-full-data-vector-frobs simple-array-unsigned-byte-32 unsigned-num
     unsigned-reg)
-  (def-full-data-vector-frobs simple-array-signed-byte-30 tagged-num any-reg)
-  (def-full-data-vector-frobs simple-array-unsigned-byte-29 positive-fixnum any-reg)
+  (def-full-data-vector-frobs simple-array-fixnum tagged-num any-reg)
+  (def-full-data-vector-frobs simple-array-unsigned-fixnum positive-fixnum any-reg)
   (def-full-data-vector-frobs simple-array-signed-byte-32 signed-num
     signed-reg)
   (def-full-data-vector-frobs simple-array-unsigned-byte-31 unsigned-num
   (:args (object :scs (descriptor-reg))
          (index :scs (any-reg immediate)))
   (:info offset)
-  (:arg-types simple-array-single-float positive-fixnum
+  (:arg-types simple-array-single-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 4 vector-data-offset)))
   (:results (value :scs (single-reg)))
          (index :scs (any-reg immediate))
          (value :scs (single-reg) :target result))
   (:info offset)
-  (:arg-types simple-array-single-float positive-fixnum
+  (:arg-types simple-array-single-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 4 vector-data-offset))
               single-float)
          (index :scs (any-reg immediate)))
   (:info offset)
   (:arg-types simple-array-double-float
-              positive-fixnum
+              tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 8 vector-data-offset)))
   (:results (value :scs (double-reg)))
          (index :scs (any-reg immediate))
          (value :scs (double-reg) :target result))
   (:info offset)
-  (:arg-types simple-array-double-float positive-fixnum
+  (:arg-types simple-array-double-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 8 vector-data-offset))
               double-float)
   (:args (object :scs (descriptor-reg))
          (index :scs (any-reg immediate)))
   (:info offset)
-  (:arg-types simple-array-complex-single-float positive-fixnum
+  (:arg-types simple-array-complex-single-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 8 vector-data-offset)))
   (:results (value :scs (complex-single-reg)))
          (index :scs (any-reg immediate))
          (value :scs (complex-single-reg) :target result))
   (:info offset)
-  (:arg-types simple-array-complex-single-float positive-fixnum
+  (:arg-types simple-array-complex-single-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 8 vector-data-offset))
               complex-single-float)
   (:args (object :scs (descriptor-reg))
          (index :scs (any-reg immediate)))
   (:info offset)
-  (:arg-types simple-array-complex-double-float positive-fixnum
+  (:arg-types simple-array-complex-double-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 16 vector-data-offset)))
   (:results (value :scs (complex-double-reg)))
          (index :scs (any-reg immediate))
          (value :scs (complex-double-reg) :target result))
   (:info offset)
-  (:arg-types simple-array-complex-double-float positive-fixnum
+  (:arg-types simple-array-complex-double-float tagged-num
               (:constant (constant-displacement other-pointer-lowtag
                                                 16 vector-data-offset))
               complex-double-float)
       (:translate data-vector-ref-with-offset)
       (:policy :fast-safe)
       (:args (object :scs (descriptor-reg))
-             (index :scs (unsigned-reg immediate)))
+             (index :scs (signed-reg immediate)))
       (:info offset)
-      (:arg-types ,ptype positive-fixnum
+      (:arg-types ,ptype tagged-num
                   (:constant (constant-displacement other-pointer-lowtag
                                                     1 vector-data-offset)))
       (:results (value :scs ,scs))
       (:translate data-vector-set-with-offset)
       (:policy :fast-safe)
       (:args (object :scs (descriptor-reg) :to (:eval 0))
-             (index :scs (unsigned-reg immediate) :to (:eval 0))
+             (index :scs (signed-reg immediate) :to (:eval 0))
              (value :scs ,scs ,@(unless 8-bit-tns-p
                                   '(:target eax))))
       (:info offset)
-      (:arg-types ,ptype positive-fixnum
+      (:arg-types ,ptype tagged-num
                   (:constant (constant-displacement other-pointer-lowtag
                                                     1 vector-data-offset))
                   ,element-type)
         (:translate data-vector-ref-with-offset)
         (:policy :fast-safe)
         (:args (object :scs (descriptor-reg))
-               (index :scs (unsigned-reg immediate)))
+               (index :scs (signed-reg immediate)))
         (:info offset)
-        (:arg-types ,ptype positive-fixnum
+        (:arg-types ,ptype tagged-num
                     (:constant (constant-displacement other-pointer-lowtag
                                                       2 vector-data-offset)))
         (:results (value :scs ,scs))
         (:translate data-vector-set-with-offset)
         (:policy :fast-safe)
         (:args (object :scs (descriptor-reg) :to (:eval 0))
-               (index :scs (unsigned-reg immediate) :to (:eval 0))
+               (index :scs (signed-reg immediate) :to (:eval 0))
                (value :scs ,scs :target eax))
         (:info offset)
-        (:arg-types ,ptype positive-fixnum
+        (:arg-types ,ptype tagged-num
                     (:constant (constant-displacement other-pointer-lowtag
                                                       2 vector-data-offset))
                     ,element-type)
 
 (define-vop (get-vector-subtype get-header-data))
 (define-vop (set-vector-subtype set-header-data))
+\f
+;;;; ATOMIC-INCF for arrays
+
+(define-vop (array-atomic-incf/word)
+  (:translate %array-atomic-incf/word)
+  (:policy :fast-safe)
+  (:args (array :scs (descriptor-reg))
+         (index :scs (any-reg))
+         (diff :scs (unsigned-reg) :target result))
+  (:arg-types * positive-fixnum unsigned-num)
+  (:results (result :scs (unsigned-reg)))
+  (:result-types unsigned-num)
+  (:generator 4
+    (inst xadd (make-ea :dword :base array
+                        :scale 1 :index index
+                        :disp (- (* vector-data-offset n-word-bytes)
+                                 other-pointer-lowtag))
+          diff :lock)
+    (move result diff)))