]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgcc/config/nios2/tramp.c
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / nios2 / tramp.c
index 78661e237070f52823768c071acbc737cac75aca..a492d11655bc25f1c88d40d35a44d60091714f64 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2021 Free Software Foundation, Inc.
    Contributed by Altera and Mentor Graphics, Inc.
 
 This file is free software; you can redistribute it and/or modify it
@@ -33,13 +33,27 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #define SC_REGNO 12
 
-#define MOVHI(reg,imm16) \
+/* Instruction encodings depend on the ISA level.  */
+#if __nios2_arch__ == 2
+#define MOVHI(reg,imm16)                       \
+  (((reg) << 11) | ((imm16) << 16) | 0x34)
+#define ORI(reg,imm16)                                         \
+  (((reg) << 11) | ((reg) << 6) | ((imm16) << 16) | 0x14)
+#define JMP(reg)                               \
+  (((reg) << 6) | (0x0d << 26) | 0x20)
+
+#elif __nios2_arch__ == 1
+#define MOVHI(reg,imm16)                       \
   (((reg) << 22) | ((imm16) << 6) | 0x34)
-#define ORI(reg,imm16) \
+#define ORI(reg,imm16)                                         \
   (((reg) << 27) | ((reg) << 22) | ((imm16) << 6) | 0x14)
-#define JMP(reg) \
+#define JMP(reg)                               \
   (((reg) << 27) | (0x0d << 11) | 0x3a)
 
+#else
+#error "Unknown Nios II architecture level"
+#endif
+
 void
 __trampoline_setup (unsigned int *addr, void *fnptr, void *chainptr)
 {