File: libcall-arg-exts.ll

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (98 lines) | stat: -rw-r--r-- 2,889 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
; RUN: opt < %s -passes=instcombine -S -mtriple=systemz-unknown | FileCheck %s
;
; Check that i32 arguments to generated libcalls have the proper extension
; attributes.


declare double @exp2(double)
declare float @exp2f(float)
declare fp128 @exp2l(fp128)

define double @fun1(i32 %x) {
; CHECK-LABEL: @fun1
; CHECK: call double @ldexp
  %conv = sitofp i32 %x to double
  %ret = call double @exp2(double %conv)
  ret double %ret
}

define float @fun2(i32 %x) {
; CHECK-LABEL: @fun2
; CHECK: call float @ldexpf
  %conv = sitofp i32 %x to float
  %ret = call float @exp2f(float %conv)
  ret float %ret
}

define fp128 @fun3(i8 zeroext %x) {
; CHECK-LABEL: @fun3
; CHECK: call fp128 @ldexpl
  %conv = uitofp i8 %x to fp128
  %ret = call fp128 @exp2l(fp128 %conv)
  ret fp128 %ret
}

@a = common global [60 x i8] zeroinitializer, align 1
@b = common global [60 x i8] zeroinitializer, align 1
declare i8* @__memccpy_chk(i8*, i8*, i32, i64, i64)
define i8* @fun4() {
; CHECK-LABEL: @fun4
; CHECK: call i8* @memccpy
  %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
  %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
  %ret = call i8* @__memccpy_chk(i8* %dst, i8* %src, i32 0, i64 60, i64 -1)
  ret i8* %ret
}

%FILE = type { }
@A = constant [2 x i8] c"A\00"
declare i32 @fputs(i8*, %FILE*)
define void @fun5(%FILE* %fp) {
; CHECK-LABEL: @fun5
; CHECK: call i32 @fputc
  %str = getelementptr [2 x i8], [2 x i8]* @A, i32 0, i32 0
  call i32 @fputs(i8* %str, %FILE* %fp)
  ret void
}

@empty = constant [1 x i8] zeroinitializer
declare i32 @puts(i8*)
define void @fun6() {
; CHECK-LABEL: @fun6
; CHECK: call i32 @putchar
  %str = getelementptr [1 x i8], [1 x i8]* @empty, i32 0, i32 0
  call i32 @puts(i8* %str)
  ret void
}

@.str1 = private constant [2 x i8] c"a\00"
declare i8* @strstr(i8*, i8*)
define i8* @fun7(i8* %str) {
; CHECK-LABEL: @fun7
; CHECK: call i8* @strchr
  %pat = getelementptr inbounds [2 x i8], [2 x i8]* @.str1, i32 0, i32 0
  %ret = call i8* @strstr(i8* %str, i8* %pat)
  ret i8* %ret
}

; CHECK: declare i8* @strchr(i8*, i32 signext)

@hello = constant [14 x i8] c"hello world\5Cn\00"
@chp = global i8* zeroinitializer
declare i8* @strchr(i8*, i32)
define void @fun8(i32 %chr) {
; CHECK-LABEL: @fun8
; CHECK: call i8* @memchr
  %src = getelementptr [14 x i8], [14 x i8]* @hello, i32 0, i32 0
  %dst = call i8* @strchr(i8* %src, i32 %chr)
  store i8* %dst, i8** @chp
  ret void
}

; CHECK: declare double @ldexp(double, i32 signext)
; CHECK: declare float @ldexpf(float, i32 signext)
; CHECK: declare fp128 @ldexpl(fp128, i32 signext)
; CHECK: declare i8* @memccpy(i8* noalias writeonly, i8* noalias nocapture readonly, i32 signext, i64)
; CHECK: declare noundef i32 @fputc(i32 noundef signext, %FILE* nocapture noundef)
; CHECK: declare noundef i32 @putchar(i32 noundef signext)
; CHECK: declare i8* @memchr(i8*, i32 signext, i64)