2017-03-01 07:37:04 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -disable-wasm-explicit-locals | FileCheck %s
|
2015-08-27 06:09:54 +08:00
|
|
|
|
|
|
|
; Test that globals assemble as expected.
|
|
|
|
|
2016-01-07 11:19:23 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2017-03-01 07:37:04 +08:00
|
|
|
target triple = "wasm32-unknown-unknown-wasm"
|
2015-08-27 06:09:54 +08:00
|
|
|
|
|
|
|
; CHECK-NOT: llvm.used
|
|
|
|
; CHECK-NOT: llvm.metadata
|
|
|
|
@llvm.used = appending global [1 x i32*] [i32* @g], section "llvm.metadata"
|
|
|
|
|
2015-11-17 08:20:44 +08:00
|
|
|
; CHECK: foo:
|
2015-12-16 06:01:29 +08:00
|
|
|
; CHECK: i32.const $push0=, 0{{$}}
|
|
|
|
; CHECK-NEXT: i32.load $push1=, answer($pop0){{$}}
|
2015-11-26 00:55:01 +08:00
|
|
|
; CHECK-NEXT: return $pop1{{$}}
|
2015-11-17 08:20:44 +08:00
|
|
|
define i32 @foo() {
|
|
|
|
%a = load i32, i32* @answer
|
|
|
|
ret i32 %a
|
|
|
|
}
|
|
|
|
|
2015-11-26 00:44:29 +08:00
|
|
|
; CHECK-LABEL: call_memcpy:
|
|
|
|
; CHECK-NEXT: .param i32, i32, i32{{$}}
|
|
|
|
; CHECK-NEXT: .result i32{{$}}
|
2016-01-26 12:01:11 +08:00
|
|
|
; CHECK-NEXT: i32.call $push0=, memcpy@FUNCTION, $0, $1, $2{{$}}
|
|
|
|
; CHECK-NEXT: return $pop0{{$}}
|
Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1)
Summary:
This is a resurrection of work first proposed and discussed in Aug 2015:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
and initially landed (but then backed out) in Nov 2015:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change is the first in a series that allows source and dest to each
have their own alignments by using the alignment attribute on their arguments.
In this change we:
1) Remove the alignment argument.
2) Add alignment attributes to the source & dest arguments. We, temporarily,
require that the alignments for source & dest be equal.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
Downstream users may have to update their lit tests that check for
@llvm.memcpy/memmove/memset call/declaration patterns. The following extended sed script
may help with updating the majority of your tests, but it does not catch all possible
patterns so some manual checking and updating will be required.
s~declare void @llvm\.mem(set|cpy|move)\.p([^(]*)\((.*), i32, i1\)~declare void @llvm.mem\1.p\2(\3, i1)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* \3, i8 \4, i8 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* \3, i8 \4, i16 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* \3, i8 \4, i32 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* \3, i8 \4, i64 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* \3, i8 \4, i128 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* align \6 \3, i8 \4, i8 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* align \6 \3, i8 \4, i16 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* align \6 \3, i8 \4, i32 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* align \6 \3, i8 \4, i64 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* align \6 \3, i8 \4, i128 \5, i1 \7)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* \4, i8\5* \6, i8 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* \4, i8\5* \6, i16 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* \4, i8\5* \6, i32 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* \4, i8\5* \6, i64 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* \4, i8\5* \6, i128 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* align \8 \4, i8\5* align \8 \6, i8 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* align \8 \4, i8\5* align \8 \6, i16 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* align \8 \4, i8\5* align \8 \6, i32 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* align \8 \4, i8\5* align \8 \6, i64 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* align \8 \4, i8\5* align \8 \6, i128 \7, i1 \9)~g
The remaining changes in the series will:
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments.
Step 3) Update Clang to use the new IRBuilder API.
Step 4) Update Polly to use the new IRBuilder API.
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use
getDestAlignment() and getSourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reviewers: pete, hfinkel, lhames, reames, bollu
Reviewed By: reames
Subscribers: niosHD, reames, jholewinski, qcolombet, jfb, sanjoy, arsenm, dschuff, dylanmckay, mehdi_amini, sdardis, nemanjai, david2050, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, llvm-commits
Differential Revision: https://reviews.llvm.org/D41675
llvm-svn: 322965
2018-01-20 01:13:12 +08:00
|
|
|
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1)
|
2015-11-26 00:44:29 +08:00
|
|
|
define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {
|
Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1)
Summary:
This is a resurrection of work first proposed and discussed in Aug 2015:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
and initially landed (but then backed out) in Nov 2015:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change is the first in a series that allows source and dest to each
have their own alignments by using the alignment attribute on their arguments.
In this change we:
1) Remove the alignment argument.
2) Add alignment attributes to the source & dest arguments. We, temporarily,
require that the alignments for source & dest be equal.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
Downstream users may have to update their lit tests that check for
@llvm.memcpy/memmove/memset call/declaration patterns. The following extended sed script
may help with updating the majority of your tests, but it does not catch all possible
patterns so some manual checking and updating will be required.
s~declare void @llvm\.mem(set|cpy|move)\.p([^(]*)\((.*), i32, i1\)~declare void @llvm.mem\1.p\2(\3, i1)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* \3, i8 \4, i8 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* \3, i8 \4, i16 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* \3, i8 \4, i32 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* \3, i8 \4, i64 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* \3, i8 \4, i128 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* align \6 \3, i8 \4, i8 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* align \6 \3, i8 \4, i16 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* align \6 \3, i8 \4, i32 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* align \6 \3, i8 \4, i64 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* align \6 \3, i8 \4, i128 \5, i1 \7)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* \4, i8\5* \6, i8 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* \4, i8\5* \6, i16 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* \4, i8\5* \6, i32 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* \4, i8\5* \6, i64 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* \4, i8\5* \6, i128 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* align \8 \4, i8\5* align \8 \6, i8 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* align \8 \4, i8\5* align \8 \6, i16 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* align \8 \4, i8\5* align \8 \6, i32 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* align \8 \4, i8\5* align \8 \6, i64 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* align \8 \4, i8\5* align \8 \6, i128 \7, i1 \9)~g
The remaining changes in the series will:
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments.
Step 3) Update Clang to use the new IRBuilder API.
Step 4) Update Polly to use the new IRBuilder API.
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use
getDestAlignment() and getSourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reviewers: pete, hfinkel, lhames, reames, bollu
Reviewed By: reames
Subscribers: niosHD, reames, jholewinski, qcolombet, jfb, sanjoy, arsenm, dschuff, dylanmckay, mehdi_amini, sdardis, nemanjai, david2050, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, llvm-commits
Differential Revision: https://reviews.llvm.org/D41675
llvm-svn: 322965
2018-01-20 01:13:12 +08:00
|
|
|
tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %p, i8* %q, i32 %n, i1 false)
|
2015-11-26 00:44:29 +08:00
|
|
|
ret i8* %p
|
|
|
|
}
|
|
|
|
|
2016-01-07 11:19:23 +08:00
|
|
|
; CHECK: .type .Lg,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2016-01-07 11:19:23 +08:00
|
|
|
; CHECK-NEXT: .Lg:
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .int32 1337{{$}}
|
2016-01-07 11:19:23 +08:00
|
|
|
; CHECK-NEXT: .size .Lg, 4{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@g = private global i32 1337
|
|
|
|
|
|
|
|
; CHECK-LABEL: ud:
|
2016-01-08 07:18:29 +08:00
|
|
|
; CHECK-NEXT: .skip 4{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .size ud, 4{{$}}
|
|
|
|
@ud = internal global i32 undef
|
|
|
|
|
|
|
|
; CHECK: .type nil,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 2
|
|
|
|
; CHECK: nil:
|
|
|
|
; CHECK: .int32 0
|
|
|
|
; CHECK: .size nil, 4
|
2015-10-06 08:27:55 +08:00
|
|
|
@nil = internal global i32 zeroinitializer
|
|
|
|
|
|
|
|
; CHECK: .type z,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 2
|
|
|
|
; CHECK: z:
|
|
|
|
; CHECK: .int32 0
|
|
|
|
; CHECK: .size z, 4
|
2015-10-06 08:27:55 +08:00
|
|
|
@z = internal global i32 0
|
|
|
|
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .type one,@object
|
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: one:
|
|
|
|
; CHECK-NEXT: .int32 1{{$}}
|
|
|
|
; CHECK-NEXT: .size one, 4{{$}}
|
|
|
|
@one = internal global i32 1
|
|
|
|
|
|
|
|
; CHECK: .type answer,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: answer:
|
|
|
|
; CHECK-NEXT: .int32 42{{$}}
|
|
|
|
; CHECK-NEXT: .size answer, 4{{$}}
|
|
|
|
@answer = internal global i32 42
|
|
|
|
|
|
|
|
; CHECK: .type u32max,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: u32max:
|
|
|
|
; CHECK-NEXT: .int32 4294967295{{$}}
|
|
|
|
; CHECK-NEXT: .size u32max, 4{{$}}
|
|
|
|
@u32max = internal global i32 -1
|
|
|
|
|
|
|
|
; CHECK: .type ud64,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: ud64:
|
2016-01-08 07:18:29 +08:00
|
|
|
; CHECK-NEXT: .skip 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .size ud64, 8{{$}}
|
|
|
|
@ud64 = internal global i64 undef
|
|
|
|
|
|
|
|
; CHECK: .type nil64,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
|
|
|
; CHECK-NEXT: nil64:
|
|
|
|
; CHECK-NEXT: .int64 0{{$}}
|
|
|
|
; CHECK-NEXT: .size nil64, 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@nil64 = internal global i64 zeroinitializer
|
|
|
|
|
|
|
|
; CHECK: .type z64,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
|
|
|
; CHECK-NEXT: z64:
|
|
|
|
; CHECK-NEXT: .int64 0{{$}}
|
|
|
|
; CHECK-NEXT: .size z64, 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@z64 = internal global i64 0
|
|
|
|
|
|
|
|
; CHECK: .type twoP32,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: twoP32:
|
|
|
|
; CHECK-NEXT: .int64 4294967296{{$}}
|
|
|
|
; CHECK-NEXT: .size twoP32, 8{{$}}
|
|
|
|
@twoP32 = internal global i64 4294967296
|
|
|
|
|
|
|
|
; CHECK: .type u64max,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: u64max:
|
|
|
|
; CHECK-NEXT: .int64 -1{{$}}
|
|
|
|
; CHECK-NEXT: .size u64max, 8{{$}}
|
|
|
|
@u64max = internal global i64 -1
|
|
|
|
|
|
|
|
; CHECK: .type f32ud,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: f32ud:
|
2016-01-08 07:18:29 +08:00
|
|
|
; CHECK-NEXT: .skip 4{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .size f32ud, 4{{$}}
|
|
|
|
@f32ud = internal global float undef
|
|
|
|
|
|
|
|
; CHECK: .type f32nil,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
|
|
|
; CHECK-NEXT: f32nil:
|
|
|
|
; CHECK-NEXT: .int32 0{{$}}
|
|
|
|
; CHECK-NEXT: .size f32nil, 4{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@f32nil = internal global float zeroinitializer
|
|
|
|
|
|
|
|
; CHECK: .type f32z,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
|
|
|
; CHECK-NEXT: f32z:
|
|
|
|
; CHECK-NEXT: .int32 0{{$}}
|
|
|
|
; CHECK-NEXT: .size f32z, 4{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@f32z = internal global float 0.0
|
|
|
|
|
|
|
|
; CHECK: .type f32nz,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK: f32nz:
|
|
|
|
; CHECK: .int32 2147483648{{$}}
|
|
|
|
; CHECK: .size f32nz, 4{{$}}
|
|
|
|
@f32nz = internal global float -0.0
|
|
|
|
|
|
|
|
; CHECK: .type f32two,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 2{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: f32two:
|
|
|
|
; CHECK-NEXT: .int32 1073741824{{$}}
|
|
|
|
; CHECK-NEXT: .size f32two, 4{{$}}
|
|
|
|
@f32two = internal global float 2.0
|
|
|
|
|
|
|
|
; CHECK: .type f64ud,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: f64ud:
|
2016-01-08 07:18:29 +08:00
|
|
|
; CHECK-NEXT: .skip 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: .size f64ud, 8{{$}}
|
|
|
|
@f64ud = internal global double undef
|
|
|
|
|
|
|
|
; CHECK: .type f64nil,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
|
|
|
; CHECK-NEXT: f64nil:
|
|
|
|
; CHECK-NEXT: .int64 0{{$}}
|
|
|
|
; CHECK-NEXT: .size f64nil, 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@f64nil = internal global double zeroinitializer
|
|
|
|
|
|
|
|
; CHECK: .type f64z,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
|
|
|
; CHECK-NEXT: f64z:
|
|
|
|
; CHECK-NEXT: .int64 0{{$}}
|
|
|
|
; CHECK-NEXT: .size f64z, 8{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
@f64z = internal global double 0.0
|
|
|
|
|
|
|
|
; CHECK: .type f64nz,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: f64nz:
|
|
|
|
; CHECK-NEXT: .int64 -9223372036854775808{{$}}
|
|
|
|
; CHECK-NEXT: .size f64nz, 8{{$}}
|
|
|
|
@f64nz = internal global double -0.0
|
|
|
|
|
|
|
|
; CHECK: .type f64two,@object
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 3{{$}}
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-NEXT: f64two:
|
|
|
|
; CHECK-NEXT: .int64 4611686018427387904{{$}}
|
|
|
|
; CHECK-NEXT: .size f64two, 8{{$}}
|
|
|
|
@f64two = internal global double 2.0
|
2015-12-15 10:02:51 +08:00
|
|
|
|
|
|
|
; Indexing into a global array produces a relocation.
|
|
|
|
; CHECK: .type arr,@object
|
|
|
|
; CHECK: .type ptr,@object
|
|
|
|
; CHECK: ptr:
|
|
|
|
; CHECK-NEXT: .int32 arr+80
|
|
|
|
; CHECK-NEXT: .size ptr, 4
|
|
|
|
@arr = global [128 x i32] zeroinitializer, align 16
|
|
|
|
@ptr = global i32* getelementptr inbounds ([128 x i32], [128 x i32]* @arr, i32 0, i32 20), align 4
|
2015-12-18 04:50:45 +08:00
|
|
|
|
|
|
|
; Constant global.
|
|
|
|
; CHECK: .type rom,@object{{$}}
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: .section .rodata.rom,
|
2015-12-18 04:50:45 +08:00
|
|
|
; CHECK: .globl rom{{$}}
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 4{{$}}
|
2015-12-18 04:50:45 +08:00
|
|
|
; CHECK: rom:
|
2016-01-08 07:18:29 +08:00
|
|
|
; CHECK: .skip 512{{$}}
|
2015-12-18 04:50:45 +08:00
|
|
|
; CHECK: .size rom, 512{{$}}
|
|
|
|
@rom = constant [128 x i32] zeroinitializer, align 16
|
2016-01-14 03:29:37 +08:00
|
|
|
|
|
|
|
; CHECK: .type array,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK: array:
|
2016-01-14 03:29:37 +08:00
|
|
|
; CHECK-NEXT: .skip 8
|
|
|
|
; CHECK-NEXT: .size array, 8
|
|
|
|
; CHECK: .type pointer_to_array,@object
|
2017-03-01 07:37:04 +08:00
|
|
|
; CHECK-NEXT: .section .data.rel.ro.pointer_to_array,
|
2016-01-14 03:29:37 +08:00
|
|
|
; CHECK-NEXT: .globl pointer_to_array
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK-NEXT: .p2align 2
|
2016-01-14 03:29:37 +08:00
|
|
|
; CHECK-NEXT: pointer_to_array:
|
|
|
|
; CHECK-NEXT: .int32 array+4
|
|
|
|
; CHECK-NEXT: .size pointer_to_array, 4
|
|
|
|
@array = internal constant [8 x i8] zeroinitializer, align 1
|
|
|
|
@pointer_to_array = constant i8* getelementptr inbounds ([8 x i8], [8 x i8]* @array, i32 0, i32 4), align 4
|
2017-12-07 08:14:30 +08:00
|
|
|
|
|
|
|
; Handle external objects with opaque type.
|
|
|
|
%struct.ASTRUCT = type opaque
|
|
|
|
@g_struct = external global %struct.ASTRUCT, align 1
|
|
|
|
define i32 @address_of_opaque() {
|
|
|
|
ret i32 ptrtoint (%struct.ASTRUCT* @g_struct to i32)
|
|
|
|
}
|