[cfe-commits] [PATCH] Change cmp_XY x86/AVX builtin definition from static inline to macro in avxintrin.h

Syoyo Fujita syoyofujita at gmail.com
Thu Apr 7 21:42:50 PDT 2011


Hi John,

>> mmx-builtins.c tests asm output, but in my patch I'd like to test LLVM
>> IR outout.
>
> This is easy;  just turn the -S in the RUN line into an -emit-llvm.  That
> will also avoid any AVX-related bugs in the backend.
>
> The main thing is that there are several portability workarounds in that
> test, like the #define, that you'll want to borrow for your test.

Okay, I've fixed a test code. Does this looks OK? If so, I'll submit a
fixed test again.
At least it works well in my local ToT on Mac.

1) Replace -S with -emit-llvm
2) Add #define _MM_MALLOC_H
3) Since this test checks if third(last) argument is constant
expression, we don't care how other arguments are codegen'ed. Use wild
pattern for that arguments to relax LLVM IR codegen matching.

------------------------------------------

// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature
+avx -emit-llvm -o - | FileCheck %s

// Don't include mm_malloc.h, it's system specific.
#define __MM_MALLOC_H

#include <immintrin.h>

__m128d test_cmp_pd(__m128d a, __m128d b) {
  // CHECK: @llvm.x86.sse2.cmp.pd({{.*}}, i8 13)
  return _mm_cmp_pd(a, b, _CMP_GE_OS);
}

....

--
Syoyo




More information about the cfe-commits mailing list