i386-sse-9.c

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· C语言 代码 · 共 37 行

C
37
字号
/* { dg-do run { target i?86-*-* x86_64-*-* } } *//* { dg-options "-O2 -msse" } */#include <xmmintrin.h>#include <stdlib.h>#include <stddef.h>#include <string.h>intmain(){  int alignment, n;  void *ptr;  int errors = 0;  const char test [] = "This is a test.";  for (alignment = 1; alignment <= (1 << 20); alignment += alignment)    {      ptr = _mm_malloc (alignment, alignment);      if (((ptrdiff_t) ptr) & (alignment - 1))	abort ();      if (ptr)	{	  n = alignment > sizeof test ? sizeof test : alignment;	  memcpy (ptr, test, n);	  if (memcmp (ptr, test, n) != 0)	    errors++;	  _mm_free (ptr);	}      else	errors++;    }     if (errors != 0)    abort ();  exit (0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?