Nios® II Processor Reference Guide

ID 683836
Date 8/28/2023
Public
Document Table of Contents

3.9.4. Comparison Instructions

The Nios II architecture supports a number of comparison instructions. All of these compare two registers or a register and an immediate value, and write either one (if true) or zero to the result register. These instructions perform all the equality and relational operators of the C programming language.
Table 48.  Comparison Instructions
Instruction Description
cmpeq
==
cmpne
!=
cmpge
signed >=
cmpgeu
unsigned >=
cmpgt
signed >
cmpgtu
unsigned >
cmple
unsigned <=
cmpleu
unsigned <=
cmplt
signed <
cmpltu
unsigned <
cmpeqi
cmpnei
cmpgei
cmpgeui
cmpgti
cmpgtui
cmplei
cmpleui
cmplti
cmpltui
These instructions are immediate versions of the comparison operations. They compare the value of a register and a 16-bit immediate value. Signed operations sign-extend the immediate value to 32-bits. Unsigned operations fill the upper bits with zero.