⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mips-hilo-1.c

📁 linux下编程用 编译软件
💻 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 + -