1 <!-- Instructions here described in PowerISA Version 3.0 B Book 1 -->
3 <!-- Section 3.3.10 Fixed-Point Compare Instructions Pages 84 - 88 -->
5 <!-- The fixed-point Compare instructions compare the contents of register RA with -->
6 <!-- (1) the sign-extended value of the SI field, (2) the zero-extended value of the -->
7 <!-- UI field, or (3) the contents of register RB. The comparison is signed for cmpi -->
8 <!-- and cmp, and unsigned for cmpli and cmpl. -->
18 if L = 0 then a <- EXTS((RA)[32:63])
20 if a < EXTS(SI) then c <- 0b100
21 else if a > EXTS(SI) then c <- 0b010
23 CR[4*BF+32:4*BF+35] <- c || XER[SO]
25 Special Registers Altered:
38 a <- EXTS((RA)[32:63])
39 b <- EXTS((RB)[32:63])
43 if a < b then c <- 0b100
44 else if a > b then c <- 0b010
46 CR[4*BF+32:4*BF+35] <- c || XER[SO]
48 Special Registers Altered:
52 # Compare Logical Immediate
60 if L = 0 then a <- [0]*32 || (RA)[32:63]
62 if a <u ([0]*48 || UI) then c <- 0b100
63 else if a >u ([0]*48 || UI) then c <- 0b010
65 CR[4*BF+32:4*BF+35] <- c || XER[SO]
67 Special Registers Altered:
80 a <- [0]*32 || (RA)[32:63]
81 b <- [0]*32 || (RB)[32:63]
85 if a <u b then c <- 0b100
86 else if a >u b then c <- 0b010
88 CR[4*BF+32:4*BF+35] <- c || XER[SO]
90 Special Registers Altered:
102 src1 <- EXTZ((RA)[56:63])
103 src21hi <- EXTZ((RB)[32:39])
104 src21lo <- EXTZ((RB)[40:47])
105 src22hi <- EXTZ((RB)[48:55])
106 src22lo <- EXTZ((RB)[56:63])
108 in_range <- (src22lo <= src1) & (src1 <= src22hi)
110 in_range <- (((src21lo <= src1) & (src1 <= src21hi)) |
111 ((src22lo <= src1) & (src1 <= src22hi)))
113 CR[4*BF+33] <- in_range
117 Special Registers Altered:
131 match <- ((src1 = (RB)[00:07]) |
132 (src1 = (RB)[08:15]) |
133 (src1 = (RB)[16:23]) |
134 (src1 = (RB)[24:31]) |
135 (src1 = (RB)[32:39]) |
136 (src1 = (RB)[40:47]) |
137 (src1 = (RB)[48:55]) |
138 (src1 = (RB)[56:63]))
144 Special Registers Altered:
148 <!-- Checked March 2021 -->