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)[XLEN/2:XLEN-1])
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)[XLEN/2:XLEN-1])
39 b <- EXTS((RB)[XLEN/2:XLEN-1])
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]*(XLEN/2) || (RA)[XLEN/2:XLEN-1]
62 if a <u ([0]*(XLEN-16) || UI) then c <- 0b100
63 else if a >u ([0]*(XLEN-16) || UI) then c <- 0b010
65 CR[4*BF+32:4*BF+35] <- c || XER[SO]
67 Special Registers Altered:
80 a <- [0]*(XLEN/2) || (RA)[XLEN/2:XLEN-1]
81 b <- [0]*(XLEN/2) || (RB)[XLEN/2:XLEN-1]
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)[XLEN-8:XLEN-1])
103 src21hi <- EXTZ((RB)[XLEN-32:XLEN-23])
104 src21lo <- EXTZ((RB)[XLEN-24:XLEN-17])
105 src22hi <- EXTZ((RB)[XLEN-16:XLEN-9])
106 src22lo <- EXTZ((RB)[XLEN-8:XLEN-1])
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:
130 src1 <- src1[XLEN-8:XLEN-1]
132 for i = 0 to ((XLEN/8)-1)
133 match <- (match | (src1 = (RB)[8*i:8*i+7]))
139 Special Registers Altered:
143 <!-- Checked March 2021 -->