llvm.org GIT mirror llvm / 60808c7
Convert Windows to Unix line endings, no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186264 91177308-0d34-0410-b5e6-96231b3b80d8 Stephen Lin 6 years ago
3 changed file(s) with 217 addition(s) and 217 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llc < %s
1
2 ; This test formerly failed because of wrong custom lowering for
3 ; fptosi of ppc_fp128.
4
5 target datalayout = "E-p:32:32:32-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:64:128-v64:64:64-v128:128:128-a0:0:64-n32"
6 target triple = "powerpc-unknown-linux-gnu"
7
8 %core.time.TickDuration = type { i64 }
9
10 @_D4core4time12TickDuration11ticksPerSecyl = global i64 0
11 @.str5 = internal unnamed_addr constant [40 x i8] c"..\5Cldc\5Cruntime\5Cdruntime\5Csrc\5Ccore\5Ctime.d\00"
12 @.str83 = internal constant [10 x i8] c"null this\00"
13 @.modulefilename = internal constant { i32, i8* } { i32 39, i8* getelementptr inbounds ([40 x i8]* @.str5, i32 0, i32 0) }
14
15 declare i8* @_d_assert_msg({ i32, i8* }, { i32, i8* }, i32)
16
17
18 define weak_odr fastcc i64 @_D4core4time12TickDuration30__T2toVAyaa7_7365636f6e6473TlZ2toMxFNaNbNfZl(%core.time.TickDuration* %.this_arg) {
19 entry:
20 %unitsPerSec = alloca i64, align 8
21 %tmp = icmp ne %core.time.TickDuration* %.this_arg, null
22 br i1 %tmp, label %noassert, label %assert
23
24 assert: ; preds = %entry
25 %tmp1 = load { i32, i8* }* @.modulefilename
26 %0 = call i8* @_d_assert_msg({ i32, i8* } { i32 9, i8* getelementptr inbounds ([10 x i8]* @.str83, i32 0, i32 0) }, { i32, i8* } %tmp1, i32 1586)
27 unreachable
28
29 noassert: ; preds = %entry
30 %tmp2 = getelementptr %core.time.TickDuration* %.this_arg, i32 0, i32 0
31 %tmp3 = load i64* %tmp2
32 %tmp4 = sitofp i64 %tmp3 to ppc_fp128
33 %tmp5 = load i64* @_D4core4time12TickDuration11ticksPerSecyl
34 %tmp6 = sitofp i64 %tmp5 to ppc_fp128
35 %tmp7 = fdiv ppc_fp128 %tmp6, 0xM80000000000000000000000000000000
36 %tmp8 = fdiv ppc_fp128 %tmp4, %tmp7
37 %tmp9 = fptosi ppc_fp128 %tmp8 to i64
38 ret i64 %tmp9
39 }
40
0 ; RUN: llc < %s
1
2 ; This test formerly failed because of wrong custom lowering for
3 ; fptosi of ppc_fp128.
4
5 target datalayout = "E-p:32:32:32-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:64:128-v64:64:64-v128:128:128-a0:0:64-n32"
6 target triple = "powerpc-unknown-linux-gnu"
7
8 %core.time.TickDuration = type { i64 }
9
10 @_D4core4time12TickDuration11ticksPerSecyl = global i64 0
11 @.str5 = internal unnamed_addr constant [40 x i8] c"..\5Cldc\5Cruntime\5Cdruntime\5Csrc\5Ccore\5Ctime.d\00"
12 @.str83 = internal constant [10 x i8] c"null this\00"
13 @.modulefilename = internal constant { i32, i8* } { i32 39, i8* getelementptr inbounds ([40 x i8]* @.str5, i32 0, i32 0) }
14
15 declare i8* @_d_assert_msg({ i32, i8* }, { i32, i8* }, i32)
16
17
18 define weak_odr fastcc i64 @_D4core4time12TickDuration30__T2toVAyaa7_7365636f6e6473TlZ2toMxFNaNbNfZl(%core.time.TickDuration* %.this_arg) {
19 entry:
20 %unitsPerSec = alloca i64, align 8
21 %tmp = icmp ne %core.time.TickDuration* %.this_arg, null
22 br i1 %tmp, label %noassert, label %assert
23
24 assert: ; preds = %entry
25 %tmp1 = load { i32, i8* }* @.modulefilename
26 %0 = call i8* @_d_assert_msg({ i32, i8* } { i32 9, i8* getelementptr inbounds ([10 x i8]* @.str83, i32 0, i32 0) }, { i32, i8* } %tmp1, i32 1586)
27 unreachable
28
29 noassert: ; preds = %entry
30 %tmp2 = getelementptr %core.time.TickDuration* %.this_arg, i32 0, i32 0
31 %tmp3 = load i64* %tmp2
32 %tmp4 = sitofp i64 %tmp3 to ppc_fp128
33 %tmp5 = load i64* @_D4core4time12TickDuration11ticksPerSecyl
34 %tmp6 = sitofp i64 %tmp5 to ppc_fp128
35 %tmp7 = fdiv ppc_fp128 %tmp6, 0xM80000000000000000000000000000000
36 %tmp8 = fdiv ppc_fp128 %tmp4, %tmp7
37 %tmp9 = fptosi ppc_fp128 %tmp8 to i64
38 ret i64 %tmp9
39 }
40
5353
5454 ; CHECK: blend_test4
5555 ; CHECK: vblendpd
56 ; CHECK: ret
57 define <4 x i64> @blend_test4(<4 x i64> %a, <4 x i64> %b) nounwind alwaysinline {
58 %t = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32>
59 ret <4 x i64> %t
56 ; CHECK: ret
57 define <4 x i64> @blend_test4(<4 x i64> %a, <4 x i64> %b) nounwind alwaysinline {
58 %t = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32>
59 ret <4 x i64> %t
6060 }
6161
6262 ; CHECK: vpshufhw $27, %ymm
None //===- MCJITMemoryManagerTest.cpp - Unit tests for the JIT memory manager -===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
10 #include "llvm/ADT/OwningPtr.h"
11 #include "llvm/ExecutionEngine/JIT.h"
12 #include "gtest/gtest.h"
13
14 using namespace llvm;
15
16 namespace {
17
18 TEST(MCJITMemoryManagerTest, BasicAllocations) {
19 OwningPtr MemMgr(new SectionMemoryManager());
20
21 uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);
22 uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, true);
23 uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3);
24 uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, false);
25
26 EXPECT_NE((uint8_t*)0, code1);
27 EXPECT_NE((uint8_t*)0, code2);
28 EXPECT_NE((uint8_t*)0, data1);
29 EXPECT_NE((uint8_t*)0, data2);
30
31 // Initialize the data
32 for (unsigned i = 0; i < 256; ++i) {
33 code1[i] = 1;
34 code2[i] = 2;
35 data1[i] = 3;
36 data2[i] = 4;
37 }
38
39 // Verify the data (this is checking for overlaps in the addresses)
40 for (unsigned i = 0; i < 256; ++i) {
41 EXPECT_EQ(1, code1[i]);
42 EXPECT_EQ(2, code2[i]);
43 EXPECT_EQ(3, data1[i]);
44 EXPECT_EQ(4, data2[i]);
45 }
46
47 std::string Error;
48 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
49 }
50
51 TEST(MCJITMemoryManagerTest, LargeAllocations) {
52 OwningPtr MemMgr(new SectionMemoryManager());
53
54 uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1);
55 uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, true);
56 uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3);
57 uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, false);
58
59 EXPECT_NE((uint8_t*)0, code1);
60 EXPECT_NE((uint8_t*)0, code2);
61 EXPECT_NE((uint8_t*)0, data1);
62 EXPECT_NE((uint8_t*)0, data2);
63
64 // Initialize the data
65 for (unsigned i = 0; i < 0x100000; ++i) {
66 code1[i] = 1;
67 code2[i] = 2;
68 data1[i] = 3;
69 data2[i] = 4;
70 }
71
72 // Verify the data (this is checking for overlaps in the addresses)
73 for (unsigned i = 0; i < 0x100000; ++i) {
74 EXPECT_EQ(1, code1[i]);
75 EXPECT_EQ(2, code2[i]);
76 EXPECT_EQ(3, data1[i]);
77 EXPECT_EQ(4, data2[i]);
78 }
79
80 std::string Error;
81 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
82 }
83
84 TEST(MCJITMemoryManagerTest, ManyAllocations) {
85 OwningPtr MemMgr(new SectionMemoryManager());
86
87 uint8_t* code[10000];
88 uint8_t* data[10000];
89
90 for (unsigned i = 0; i < 10000; ++i) {
91 const bool isReadOnly = i % 2 == 0;
92
93 code[i] = MemMgr->allocateCodeSection(32, 0, 1);
94 data[i] = MemMgr->allocateDataSection(32, 0, 2, isReadOnly);
95
96 for (unsigned j = 0; j < 32; j++) {
97 code[i][j] = 1 + (i % 254);
98 data[i][j] = 2 + (i % 254);
99 }
100
101 EXPECT_NE((uint8_t *)0, code[i]);
102 EXPECT_NE((uint8_t *)0, data[i]);
103 }
104
105 // Verify the data (this is checking for overlaps in the addresses)
106 for (unsigned i = 0; i < 10000; ++i) {
107 for (unsigned j = 0; j < 32;j++ ) {
108 uint8_t ExpectedCode = 1 + (i % 254);
109 uint8_t ExpectedData = 2 + (i % 254);
110 EXPECT_EQ(ExpectedCode, code[i][j]);
111 EXPECT_EQ(ExpectedData, data[i][j]);
112 }
113 }
114
115 std::string Error;
116 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
117 }
118
119 TEST(MCJITMemoryManagerTest, ManyVariedAllocations) {
120 OwningPtr MemMgr(new SectionMemoryManager());
121
122 uint8_t* code[10000];
123 uint8_t* data[10000];
124
125 for (unsigned i = 0; i < 10000; ++i) {
126 uintptr_t CodeSize = i % 16 + 1;
127 uintptr_t DataSize = i % 8 + 1;
128
129 bool isReadOnly = i % 3 == 0;
130 unsigned Align = 8 << (i % 4);
131
132 code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i);
133 data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000,
134 isReadOnly);
135
136 for (unsigned j = 0; j < CodeSize; j++) {
137 code[i][j] = 1 + (i % 254);
138 }
139
140 for (unsigned j = 0; j < DataSize; j++) {
141 data[i][j] = 2 + (i % 254);
142 }
143
144 EXPECT_NE((uint8_t *)0, code[i]);
145 EXPECT_NE((uint8_t *)0, data[i]);
146
147 uintptr_t CodeAlign = Align ? (uintptr_t)code[i] % Align : 0;
148 uintptr_t DataAlign = Align ? (uintptr_t)data[i] % Align : 0;
149
150 EXPECT_EQ((uintptr_t)0, CodeAlign);
151 EXPECT_EQ((uintptr_t)0, DataAlign);
152 }
153
154 for (unsigned i = 0; i < 10000; ++i) {
155 uintptr_t CodeSize = i % 16 + 1;
156 uintptr_t DataSize = i % 8 + 1;
157
158 for (unsigned j = 0; j < CodeSize; j++) {
159 uint8_t ExpectedCode = 1 + (i % 254);
160 EXPECT_EQ(ExpectedCode, code[i][j]);
161 }
162
163 for (unsigned j = 0; j < DataSize; j++) {
164 uint8_t ExpectedData = 2 + (i % 254);
165 EXPECT_EQ(ExpectedData, data[i][j]);
166 }
167 }
168 }
169
170 } // Namespace
171
0 //===- MCJITMemoryManagerTest.cpp - Unit tests for the JIT memory manager -===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
10 #include "llvm/ADT/OwningPtr.h"
11 #include "llvm/ExecutionEngine/JIT.h"
12 #include "gtest/gtest.h"
13
14 using namespace llvm;
15
16 namespace {
17
18 TEST(MCJITMemoryManagerTest, BasicAllocations) {
19 OwningPtr MemMgr(new SectionMemoryManager());
20
21 uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);
22 uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, true);
23 uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3);
24 uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, false);
25
26 EXPECT_NE((uint8_t*)0, code1);
27 EXPECT_NE((uint8_t*)0, code2);
28 EXPECT_NE((uint8_t*)0, data1);
29 EXPECT_NE((uint8_t*)0, data2);
30
31 // Initialize the data
32 for (unsigned i = 0; i < 256; ++i) {
33 code1[i] = 1;
34 code2[i] = 2;
35 data1[i] = 3;
36 data2[i] = 4;
37 }
38
39 // Verify the data (this is checking for overlaps in the addresses)
40 for (unsigned i = 0; i < 256; ++i) {
41 EXPECT_EQ(1, code1[i]);
42 EXPECT_EQ(2, code2[i]);
43 EXPECT_EQ(3, data1[i]);
44 EXPECT_EQ(4, data2[i]);
45 }
46
47 std::string Error;
48 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
49 }
50
51 TEST(MCJITMemoryManagerTest, LargeAllocations) {
52 OwningPtr MemMgr(new SectionMemoryManager());
53
54 uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1);
55 uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, true);
56 uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3);
57 uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, false);
58
59 EXPECT_NE((uint8_t*)0, code1);
60 EXPECT_NE((uint8_t*)0, code2);
61 EXPECT_NE((uint8_t*)0, data1);
62 EXPECT_NE((uint8_t*)0, data2);
63
64 // Initialize the data
65 for (unsigned i = 0; i < 0x100000; ++i) {
66 code1[i] = 1;
67 code2[i] = 2;
68 data1[i] = 3;
69 data2[i] = 4;
70 }
71
72 // Verify the data (this is checking for overlaps in the addresses)
73 for (unsigned i = 0; i < 0x100000; ++i) {
74 EXPECT_EQ(1, code1[i]);
75 EXPECT_EQ(2, code2[i]);
76 EXPECT_EQ(3, data1[i]);
77 EXPECT_EQ(4, data2[i]);
78 }
79
80 std::string Error;
81 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
82 }
83
84 TEST(MCJITMemoryManagerTest, ManyAllocations) {
85 OwningPtr MemMgr(new SectionMemoryManager());
86
87 uint8_t* code[10000];
88 uint8_t* data[10000];
89
90 for (unsigned i = 0; i < 10000; ++i) {
91 const bool isReadOnly = i % 2 == 0;
92
93 code[i] = MemMgr->allocateCodeSection(32, 0, 1);
94 data[i] = MemMgr->allocateDataSection(32, 0, 2, isReadOnly);
95
96 for (unsigned j = 0; j < 32; j++) {
97 code[i][j] = 1 + (i % 254);
98 data[i][j] = 2 + (i % 254);
99 }
100
101 EXPECT_NE((uint8_t *)0, code[i]);
102 EXPECT_NE((uint8_t *)0, data[i]);
103 }
104
105 // Verify the data (this is checking for overlaps in the addresses)
106 for (unsigned i = 0; i < 10000; ++i) {
107 for (unsigned j = 0; j < 32;j++ ) {
108 uint8_t ExpectedCode = 1 + (i % 254);
109 uint8_t ExpectedData = 2 + (i % 254);
110 EXPECT_EQ(ExpectedCode, code[i][j]);
111 EXPECT_EQ(ExpectedData, data[i][j]);
112 }
113 }
114
115 std::string Error;
116 EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
117 }
118
119 TEST(MCJITMemoryManagerTest, ManyVariedAllocations) {
120 OwningPtr MemMgr(new SectionMemoryManager());
121
122 uint8_t* code[10000];
123 uint8_t* data[10000];
124
125 for (unsigned i = 0; i < 10000; ++i) {
126 uintptr_t CodeSize = i % 16 + 1;
127 uintptr_t DataSize = i % 8 + 1;
128
129 bool isReadOnly = i % 3 == 0;
130 unsigned Align = 8 << (i % 4);
131
132 code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i);
133 data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000,
134 isReadOnly);
135
136 for (unsigned j = 0; j < CodeSize; j++) {
137 code[i][j] = 1 + (i % 254);
138 }
139
140 for (unsigned j = 0; j < DataSize; j++) {
141 data[i][j] = 2 + (i % 254);
142 }
143
144 EXPECT_NE((uint8_t *)0, code[i]);
145 EXPECT_NE((uint8_t *)0, data[i]);
146
147 uintptr_t CodeAlign = Align ? (uintptr_t)code[i] % Align : 0;
148 uintptr_t DataAlign = Align ? (uintptr_t)data[i] % Align : 0;
149
150 EXPECT_EQ((uintptr_t)0, CodeAlign);
151 EXPECT_EQ((uintptr_t)0, DataAlign);
152 }
153
154 for (unsigned i = 0; i < 10000; ++i) {
155 uintptr_t CodeSize = i % 16 + 1;
156 uintptr_t DataSize = i % 8 + 1;
157
158 for (unsigned j = 0; j < CodeSize; j++) {
159 uint8_t ExpectedCode = 1 + (i % 254);
160 EXPECT_EQ(ExpectedCode, code[i][j]);
161 }
162
163 for (unsigned j = 0; j < DataSize; j++) {
164 uint8_t ExpectedData = 2 + (i % 254);
165 EXPECT_EQ(ExpectedData, data[i][j]);
166 }
167 }
168 }
169
170 } // Namespace
171