Subject: "subtract from immediate" confusion Date: Tue, 22 Sep 1998 15:06:17 -0400 From: "Steven K. Reinhardt" Organization: Univ. of Michigan EECS Newsgroups: umich.eecs.class.373 As someone mentioned in class today, "subfi" is not a PowerPC opcode. The correct opcode is "subfic". However, "subfic" does basically what you think "subfi" should do: it subtracts a register from an immediate value. That is, subfic r3, r4, 32 sets r3 to the value (32 - (r4)). "subfic" does *not* look at the old value of the carry flag as I feared (it just sets it). As long as you ignore the carry flag (which you probably will in this class), you can treat "subfic" as a "subfi". FYI: The "c" on the opcode is there to indicate that this instruction *sets* the carry flag (aka XER[CA]). This naming is to be consistent with the add immediate instructions, which come in two flavors: "addi" which does *not* set the carry flag and "addic" which does. -- ----------------------------------------------------------------------- Steven K. Reinhardt Assistant Professor, EECS The University of Michigan email: stever@eecs.umich.edu phone: (734) 647-7959, fax: (734) 763-4617 www: http://www.eecs.umich.edu/~stever