1 ; tests lowering of vector bswap
2 ; RUN: lli -jit-kind=mcjit -force-interpreter %s | FileCheck %s
6 ; CHECK: 0x1001000000000000
9 ; CHECK: 0x1001000000000000
13 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15 declare i16 @llvm.bswap.i16(i16);
16 declare i32 @llvm.bswap.i32(i32);
17 declare i64 @llvm.bswap.i64(i64);
18 declare <4 x i16> @llvm.bswap.v4i16(<4 x i16>);
19 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>);
20 declare <4 x i64> @llvm.bswap.v4i64(<4 x i64>);
21 declare i32 @printf(ptr nocapture readonly, ...);
23 @.str = private unnamed_addr constant [5 x i8] c"%#x\0A\00", align 1
24 @.strs = private unnamed_addr constant [6 x i8] c"%#hx\0A\00", align 1
25 @.strl = private unnamed_addr constant [6 x i8] c"%#lx\0A\00", align 1
27 define i32 @main() local_unnamed_addr {
28 %ra = tail call i16 @llvm.bswap.i16(i16 1)
29 %pa = tail call i32 (ptr, ...) @printf(ptr @.strs, i16 %ra)
31 %rb = tail call i32 @llvm.bswap.i32(i32 256)
32 %pb = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %rb)
34 %rc = tail call i64 @llvm.bswap.i64(i64 272)
35 %pc = tail call i32 (ptr, ...) @printf(ptr @.strl, i64 %rc)
37 %r0 = tail call <4 x i16> @llvm.bswap.v4i16(<4 x i16> <i16 1, i16 1, i16 1, i16 1>)
38 %e0 = extractelement <4 x i16> %r0, i8 0
39 %p0 = tail call i32 (ptr, ...) @printf(ptr @.strs, i16 %e0)
41 %r1 = tail call <4 x i32> @llvm.bswap.v4i32(<4 x i32> <i32 256, i32 256, i32 256, i32 256>)
42 %e1 = extractelement <4 x i32> %r1, i8 1
43 %p1 = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %e1)
45 %r2 = tail call <4 x i64> @llvm.bswap.v4i64(<4 x i64> <i64 272, i64 272, i64 272, i64 272>)
46 %e2 = extractelement <4 x i64> %r2, i8 2
47 %p2 = tail call i32 (ptr, ...) @printf(ptr @.strl, i64 %e2)