?? mips-hilo-1.c
字號:
/* f1 checks that an mtlo is not moved before an mfhi. f2 does the same for an mthi and an mflo. *//* { dg-do run { target mips*-*-* } } *//* { dg-options "-mtune=rm7000" } */extern void abort (void);extern void exit (int);#if !defined(__mips16)#define DECLARE(TYPE) \ TYPE __attribute__ ((noinline)) \ f1##TYPE (TYPE x1, TYPE x2, TYPE x3) \ { \ TYPE t1, t2; \ \ asm ("mult\t%1,%2" : "=h" (t1) : "d" (x1), "d" (x2) : "lo"); \ asm ("mflo\t%0" : "=r" (t2) : "l" (x3) : "hi"); \ return t1 + t2; \ } \ \ TYPE __attribute__ ((noinline)) \ f2##TYPE (TYPE x1, TYPE x2, TYPE x3) \ { \ TYPE t1, t2; \ \ asm ("mult\t%1,%2" : "=l" (t1) : "d" (x1), "d" (x2) : "hi"); \ asm ("mfhi\t%0" : "=r" (t2) : "h" (x3) : "lo"); \ return t1 + t2; \ }#define TEST(TYPE) \ if (f1##TYPE (1, 2, 10) != 10) \ abort (); \ if (f2##TYPE (1, 2, 40) != 42) \ abort ()typedef char c;typedef signed char sc;typedef unsigned char uc;typedef short s;typedef unsigned short us;typedef int i;typedef unsigned int ui;typedef long long ll;typedef unsigned long long ull;DECLARE (c)DECLARE (sc)DECLARE (uc)DECLARE (s)DECLARE (us)DECLARE (i)DECLARE (ui)#if defined (__mips64)DECLARE (ll)DECLARE (ull)#endifintmain (){ TEST (c); TEST (sc); TEST (uc); TEST (s); TEST (us); TEST (i); TEST (ui);#if defined (__mips64) TEST (ll); TEST (ull);#endif exit (0);}#elseint main () { exit (0); }#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -