clarify swizzle pseudocode in overview
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 1 Jul 2022 15:15:21 +0000 (16:15 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 1 Jul 2022 15:15:21 +0000 (16:15 +0100)
openpower/sv/overview.mdwn

index 24f1ec7f4f0b1a58339beace2fc96218c9eb3b09..804d7042a6f58ff41e49f2001692d004fd702466 100644 (file)
@@ -729,13 +729,13 @@ those:
     swizzle = get_swizzle_immed() # 12 bits
     for (s = 0; s < SUBVL; s++)
         remap = (swizzle >> 3*s) & 0b111
-        if remap < 4:
-           sm = id*SUBVL + remap
+        if remap == 0b000: continue            # skip
+        if remap == 0b001: break               # end marker
+        if remap == 0b010: ireg[rd+s] <= 0.0   # constant 0
+        elif remap == 0b011: ireg[rd+s] <= 1.0 # constant 1
+        else:                                  # XYZW
+           sm = id*SUBVL + (remap-4)
            ireg[rd+s] <= ireg[RA+sm]
-        elif remap == 4:
-              ireg[rd+s] <= 0.0
-        elif remap == 5:
-              ireg[rd+s] <= 1.0
 
 Note that a value of 6 (and 7) will leave the target subvector element
 untouched. This is equivalent to a predicate mask which is built-in,