e01.org

NOP (code)

In computer science, a NOP, no-op, or NOOP (pronounced "no op"; short for no operation) is a machine language instruction and its assembly language mnemonic, programming language statement, or computer protocol command that does nothing.

In computer science, a NOP, no-op, or NOOP (pronounced "no op"; short for no operation) is a machine language instruction and its assembly language mnemonic, programming language statement, or computer protocol command that does nothing. while (getchar() != '\n') {} alternatively, while (getchar() != '\n') ; or more tersely: while (getchar() != '\n'); The last form might generate a warning with some compilers or compiler options, as a semicolon placed after a parenthesis at the end of a line usually indicates the end of a function call expression. The above code continues calling the function getchar() until it returns a \n (newline) character, essentially fast-forwarding the current reading location of standard input to the beginning of next line. As well as a NOP statement, C programs will also sometimes use a NOP expression; for instance, the C standard requires that, should the NDEBUG macro be defined before the <assert.h> header, the assert() macro defined by it be defined as the expression ((void)0) . Similar techniques can be used by user code; for instance, consider the following code that defines a macro over the prefetch builtin function provided by GCC which is defined as a NOP expression if it's not available: ifdef __GNUC__ define prefetch(addr, ...) __builtin_prefetch((addr) __VA_OPT__ (,) __VA_ARGS__) else define prefetch(addr, ...) ((void)0) endif const noop = () => {};

References

  1. ^ Acorn Assembler Release 2 (PDF) . Acorn Computers. May 1991. MOVNV listed on page 218. Archived (PDF) from the original on 25 Oct 2018. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  2. ^ ARM610 32 Bit RISC Microprocessor (PDF) . ARM. August 1993. p. 20. ARM DDI 0004D. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  3. ^ ARM Architecture Reference Manual (PDF) . ARM. February 2000. section 3.2.1 on page 69. ARM DDI 0100D. Archived (PDF) from the original on 16 March 2025. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  4. ^ JH Edmondson (April 1995). "Superscalar Instruction Execution in the 21164 Alpha Microprocessor" (PDF) . p. 6. Archived (PDF) from the original on 5 January 2023. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  5. ^ Digital UNIX Assembly Language Programmer's Guide (PDF) . Digital. March 1996. see section C.7 on p.219. order no. AA-PS31D-TE. Archived from the original (PDF) on 1 October 2000. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  6. ^ AMD, "Am29050 Microprocessor User's Manual" (PDF) . 1991. pp. 223, 257. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  7. ^ "2. Stack Op Instructions §2-77 NOP No operation.". Machine Instruction Set Reference Manual (PDF) . HP 3000 Computer Systems. Hewlett-Packard. June 1984. pp. 2-23 (p. 50 of PDF). 30000-90022 – via BitSavers. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  8. ^ Hyperstone Electronics GmbH, Hyperstone E1-32/E1-16 32-Bit-Microprocessor User's Manual , rev 03/96, pages 35,38,70. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  9. ^ "IBM System/360 Model 91 Functional Characteristics" (PDF) . Systems Reference Library. IBM. p. 16 . Retrieved 17 January 2025 . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  10. ^ LoongArch Reference Manual, Volume 1: Basic Architecture, version 1.10 (PDF) . Loongson. Section 2.2.1.10 on page 23 and appendix B on page 190. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  11. ^ AMD/Xilinx, MicroBlaze Processor Reference Guide , UG984 (v2021.2) October 27, 2021, p. 281 Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  12. ^ MC88110 32-bit Microprocessor Design Specification, Revision 2.0 (PDF) . Motorola. see section 2.1.2.3 on page 11 for a listing of recommended NOPs, and pages 10, 170 and 171 for instruction encodings. Archived (PDF) from the original on 19 March 2025. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  13. ^ MSP430F2xx, MSP430G2xx Family User's Guide (PDF) . Texas Instruments. December 2004. sections 3.24 on page 47, 3.4.5 on page 63, 3.4.6.33 on page 98. Archived (PDF) from the original on 1 September 2022. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  14. ^ Power ISA version 3.1C (PDF) . OpenPOWER Foundation. 26 May 2024. Book 1 section 3.3.13 on pages 97-99; book 2 section 3.2 on page 987 and section 4.3.3 on page 1005; book 3 section 5.4.3 on page 1100, section 9.2.1 on page 1244 and section 11.3 on page 1253. Archived from the original (PDF) on 10 September 2024. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  15. ^ Cell Broadband Engine Programming Handbook, version 1.1 (PDF) . IBM. 24 April 2007. section 10.6.2.2 on page 316. Archived (PDF) from the original on 24 May 2008. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  16. ^ "SCINET Briefing: Compiling for Power6" (PDF) . IBM. February 2009. slide 9. Archived (PDF) from the original on 23 March 2025. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  17. ^ POWER8 Processor User's Manual for the Single-Chip Modul, version 1.3 (PDF) . IBM . 16 March 2016. Section 10.1.8 on page 209. Archived (PDF) from the original on 28 December 2018. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  18. ^ The RISC-V Instruction Set Manual, Volume 1: User-Level ISA, version 2.2 (PDF) . RISC-V Foundation . 7 May 2017. p. 79. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  19. ^ Weaver, D. L.; Germond, T., eds. (1994). The SPARC Architecture Manual, Version 9 (PDF) . Prentice Hall . ISBN 0-13-825001-4 . Archived from the original (PDF) on 2012-01-18 . Retrieved 2014-01-09 . Note that NOP is a special case of the SETHI instruction, with imm22 = 0 and rd = 0. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1389222000.0
  20. ^ "S+core7 Programming Guide v1.4" (PDF) . Sunplus Technology Co. Ltd. 22 March 2007. pp. 12, 90, 166. Archived from the original (PDF) on 15 November 2012. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  21. ^ SH-5 CPU Core, Volume 3: SHcompact (PDF) . SuperH Inc. 22 February 2002. p. 219. Archived from the original (PDF) on 20 March 2009. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  22. ^ SH-5 CPU Core, Volume 2: SHmedia (PDF) . SuperH Inc. 22 February 2000. p. 260. Archived from the original (PDF) on 20 March 2009. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  23. ^ Xtensa Instruction Set Architecture Reference Manual (PDF) . Tensilica. April 2010. pp. 459– 460. Archived (PDF) from the original on 5 March 2016. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  24. ^ Ada Reference Manual . Dynamic Semantics. The execution of a null_statement has no effect. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  25. ^ "Empty statement" . Mozilla Developer Network JavaScript reference . 13 March 2025. The empty statement is a semicolon ( ; ) indicating that no statement will be executed, even if JavaScript syntax requires one. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  26. ^ "Properties of the Function Prototype Object" . ECMAScript Language Specification – Edition 5.1 . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  27. ^ jQuery.noop() from jQuery API documentation Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  28. ^ "Lodash Documentation" . lodash.com . Retrieved 2017-12-15 . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1513292400.0
  29. ^ i960 Hx Microprocessor Developer's Manual] (PDF) . Intel. September 1998. see appendix B on p. 487 and appendix C on pp. 495-497 for instruction encoding, and appendix E.2.7.8 on p. 575 for the use of MOV g0,g0 as a padding-NOP. order no. 272484-002. Archived from the original (PDF) on 15 April 2003. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  30. ^ "Chapter 3. Special Characters" . Advanced Bash-Scripting Guide . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  31. ^ bash manpage > SHELL BUILTIN COMMANDS Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  32. ^ zsh manpage (zshbuiltins) > SHELL BUILTIN COMMANDS Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  33. ^ Bausum, David (2002). "TeX Primitive Control Sequences". TeX Reference Manual . Kluwer Academic Publishers . Retrieved 1 April 2020 . According to The TeXbook, 'TeX does nothing' when it encounters \relax . Actually, \relax may tell TeX, 'This is the end of what you've been doing'. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  34. ^ TeX wikibook – relax Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  35. ^ Intel Itanium Architecture Software Developer's Manual rev 2.3 (PDF) . Intel. May 2010. Book 3 section 2.2 on page 1092, section 4.3.4.1 on page 1218, section 4.4.11 on page 1248, section 4.5.3.2 on page 1255, section 4.6.9.2 on page 1264 and section 4.7.4 on page 1267. Archived (PDF) from the original on 8 December 2011. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  36. ^ a b c Alpha Architecture Handbook version 4 (PDF) . Compaq. October 1998. see section A.4.4.1 on p.285 for NOP forms and sections 3.3 on p.50 and C.1 on p.303 for instruction encodings. order no: EC–QD2KC–TE. Archived from the original (PDF) on 27 August 2004. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  37. ^ a b "NOP instruction" . ARM Compiler toolchain Assembler Reference v5.03 . ARM. {{ cite web }} : CS1 maint: deprecated archival service ( link ) Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  38. ^ a b ARM Architecture Reference Manual, ARMv7-A and ARMv7-R edition . ARM. 29 March 2018. section A8.8.120 on page 511. ARM DDI 0406C.d. Archived from the original on 27 September 2023. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  39. ^ a b ARM Software Development Toolkit Version 2.50 Reference Guide . ARM. November 1998. see sections 5.5.6 and 5.6.4 for NOPs in ARM/Thumb assembly. ARM DUI 0041C. Archived from the original on 1 June 2022. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  40. ^ a b i860 64-bit Microprocessor Programmer's Reference Manual (PDF) . Intel. February 1989. pp. 68, 172. order no. 240329-002. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  41. ^ a b c d e Motorola 68000 Programmer's Reference Manual (PDF) . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  42. ^ "ftpd.c" . Retrieved 2016-06-19 . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1466290800.0
  43. ^ a b O. Smith (12 December 1996). "StrongARM multiply speed" . Newsgroup : comp.sys.arm . Archived from the original on 16 March 2025. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  44. ^ a b PA-RISC 2.0 Architecture (PDF) . Hewlett-Packard . 1995. pp. 2– 21, 7– 103. Archived from the original (PDF) on June 21, 2020. Wikipedia revision 1373899342, retrieved 2026-11-20 · 1795129200.0
  45. ^ a b c d "Intel 64 and IA-32 Architectures Software Developer's Manual: Instruction Set Reference A-Z" . Retrieved 2012-03-01 . Wikipedia revision 1373899342, retrieved 2026-11-20 · 1330556400.0
  46. Motorola 68000 Programmer's Reference Manual . · 1788822000.0
  47. Acorn Assembler Release 2 . Acorn Computers . May 1991. · 1788822000.0
  48. ARM610 32 Bit RISC Microprocessor . ARM . August 1993. · 1788822000.0
  49. ARM Architecture Reference Manual . ARM . February 2000. · 1788822000.0
  50. - | rowspan=2 | ARM architecture family#Thumb-2|Thumb-2 (T32) | NOP || 2 || 0xBF00 | rowspan=2 | Architectural ARM T32 (Thumb-2) NOPs ("true" nops, with no register dependencies). Introduced with . · 1788822000.0
  51. - | UNOP | 4 | 0x2FFE0000 | Universal NOP. Opcode for LDQ_U r31,0($sp) . The LDQ_U (unaligned load) opcode is, on 21164 and later, special-cased so that when used with the always-0 register as a dest . · 1788822000.0
  52. Digital UNIX . Digital . · 1788822000.0
  53. Am29050 Microprocessor User's Manual . 1991. · 1788822000.0
  54. Machine Instruction Set Reference Manual . Hewlett-Packard . June 1984. · 1788822000.0
  55. Hyperstone Electronics GmbH, [https://bitsavers.org/components/hyperstone/Hyperstone_E1-32_E1_16_32-Bit_Microprocessor_Users_Manual_199603.pdf Hyperstone E1-32/E1-16 32-Bit-Microprocessor User's Manua . · 1788822000.0
  56. IBM System/360 Model 91 Functional Characteristics . · 1788822000.0
  57. Intel 64 and IA-32 Architectures Software Developer's Manual: Instruction Set Reference A-Z . · 1788822000.0
  58. LoongArch Reference Manual, Volume 1: Basic Architecture, version 1.10 . Loongson . · 1788822000.0
  59. AMD/Xilinx, [https://www.amd.com/content/dam/xilinx/support/documents/sw_manuals/xilinx2021_2/ug984-vivado-microblaze-ref.pdf MicroBlaze Processor Reference Guide], UG984 (v2021.2) October 27, 2021, p . · 1788822000.0
  60. MC88110 32-bit Microprocessor Design Specification, Revision 2.0 . Motorola . · 1788822000.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"NOP (code)". 1788878082. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1373899342

JSON record · API collection · citation policy