in SimdScope only update module AST Typecast function in SIMD mode
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Oct 2021 14:01:16 +0000 (15:01 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Oct 2021 14:01:16 +0000 (15:01 +0100)
do not whatever you do change the mode over to Simd casting in Scalar mode

src/ieee754/part/simd_scope.py

index da17af1857dda40d678264d66da43fbad5b09412..ca1349180896b86abb1b7b7d74c4b7f910d58269 100644 (file)
@@ -79,12 +79,13 @@ class SimdScope:
     def __init__(self, *, module, elwid=None,
                  vec_el_counts=None, elwid_type=IntElWid, scalar=False):
 
-        # must establish module as part of context and inform
+        # in SIMD mode, must establish module as part of context and inform
         # the module to operate under "SIMD" Type 1 (AST) casting rules,
         # not the # default "Value.cast" rules.
-        self.module = module
-        from ieee754.part.partsig import SimdSignal
-        module._setAstTypeCastFn(SimdSignal.cast)
+        if not scalar:
+            self.module = module
+            from ieee754.part.partsig import SimdSignal
+            module._setAstTypeCastFn(SimdSignal.cast)
 
         if isinstance(elwid, (IntElWid, FpElWid)):
             elwid_type = type(elwid)