brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 8a5baac Raw
42 lines · c
1// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - | FileCheck %s2// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - | FileCheck %s3 4// RUN: %clang_cc1 -x c -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - -fexperimental-new-constant-interpreter | FileCheck %s5// RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -no-enable-noundef-analysis -emit-llvm -o - -fexperimental-new-constant-interpreter | FileCheck %s6 7 8#include <x86intrin.h>9#include "builtin_test_helpers.h"10 11int test__bswapd(int X) {12// CHECK-LABEL: test__bswapd13// CHECK: call i32 @llvm.bswap.i3214  return __bswapd(X);15}16TEST_CONSTEXPR(__bswapd(0x00000000) == 0x00000000);17TEST_CONSTEXPR(__bswapd(0x01020304) == 0x04030201);18 19int test_bswap(int X) {20// CHECK-LABEL: test_bswap21// CHECK: call i32 @llvm.bswap.i3222  return _bswap(X);23}24TEST_CONSTEXPR(_bswap(0x00000000) == 0x00000000);25TEST_CONSTEXPR(_bswap(0x10203040) == 0x40302010);26 27long test__bswapq(long long X) {28// CHECK-LABEL: test__bswapq29// CHECK: call i64 @llvm.bswap.i6430  return __bswapq(X);31}32TEST_CONSTEXPR(__bswapq(0x0000000000000000ULL) == 0x0000000000000000);33TEST_CONSTEXPR(__bswapq(0x0102030405060708ULL) == 0x0807060504030201);34 35long test_bswap64(long long X) {36// CHECK-LABEL: test_bswap6437// CHECK: call i64 @llvm.bswap.i6438  return _bswap64(X);39}40TEST_CONSTEXPR(_bswap64(0x0000000000000000ULL) == 0x0000000000000000);41TEST_CONSTEXPR(_bswap64(0x1020304050607080ULL) == 0x8070605040302010);42