File: x86-builtins.c

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (45 lines) | stat: -rw-r--r-- 2,281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=CHECK-64
// RUN: %clang_cc1 -ffreestanding %s -triple=i386-unknown-unknown -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=CHECK-32

#include <x86intrin.h>

unsigned int test_castf32_u32 (float __A){
  // CHECK-64-LABEL: @test_castf32_u32
  // CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 4, i1 false)
  // CHECK-64: %{{.*}} = load i32, i32* %{{.*}}, align 4
  // CHECK-32-LABEL: @test_castf32_u32
  // CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 4, i1 false)
  // CHECK-32: %{{.*}} = load i32, i32* %{{.*}}, align 4
  return _castf32_u32(__A);
}

unsigned long long test_castf64_u64 (double __A){
  // CHECK-64-LABEL: @test_castf64_u64
  // CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 8, i1 false)
  // CHECK-64: %{{.*}} = load i64, i64* %{{.*}}, align 8
  // CHECK-32-LABEL: @test_castf64_u64
  // CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i32 8, i1 false)
  // CHECK-32: %{{.*}} = load i64, i64* %{{.*}}, align 8
  return _castf64_u64(__A);
}

float test_castu32_f32 (unsigned int __A){
  // CHECK-64-LABEL: @test_castu32_f32
  // CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 4, i1 false)
  // CHECK-64: %{{.*}} = load float, float* %{{.*}}, align 4
  // CHECK-32-LABEL: @test_castu32_f32
  // CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 4, i1 false)
  // CHECK-32: %{{.*}} = load float, float* %{{.*}}, align 4
  return _castu32_f32(__A);
}

double test_castu64_f64 (unsigned long long __A){
  // CHECK-64-LABEL: @test_castu64_f64
  // CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 8, i1 false)
  // CHECK-64: %{{.*}} = load double, double* %{{.*}}, align 8
  // CHECK-32-LABEL: @test_castu64_f64
  // CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i32 8, i1 false)
  // CHECK-32: %{{.*}} = load double, double* %{{.*}}, align 8
  return _castu64_f64(__A);
}