blob: 0a75f7a7770142b38a595536f724145a8f8eacb0 [file] [log] [blame]
Jakob Stoklund Olesenefbabe82010-05-12 00:11:24 +00001; RUN: llc < %s | FileCheck %s
2; RUN: llc < %s -regalloc=local | FileCheck -check-prefix=LOCAL %s
3; RUN: llc < %s -regalloc=fast | FileCheck -check-prefix=FAST %s
Dale Johannesen47e30e42008-09-24 23:13:09 +00004; The first argument of subfc must not be the same as any other register.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005
Jakob Stoklund Olesenefbabe82010-05-12 00:11:24 +00006; CHECK: subfc r3,r5,r4
7; CHECK: subfze r4,r6
8; LOCAL: subfc r6,r5,r4
9; LOCAL: subfze r3,r3
10; FAST: subfc r9,r8,r7
11; FAST: subfze r10,r6
12
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013; PR1357
14
15target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
16target triple = "powerpc-apple-darwin8.8.0"
17
18;long long test(int A, int B, int C) {
19; unsigned X, Y;
20; __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2"
21; : "=r" (X), "=&r" (Y)
22; : "r" (A), "rI" (B), "r" (C));
23; return ((long long)Y << 32) | X;
24;}
25
Evan Chenga9823a22008-12-19 20:58:01 +000026define i64 @test(i32 %A, i32 %B, i32 %C) nounwind {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027entry:
28 %Y = alloca i32, align 4 ; <i32*> [#uses=2]
29 %tmp4 = call i32 asm "subf${3:I}c $1,$4,$3\0A\09subfze $0,$2", "=r,=*&r,r,rI,r"( i32* %Y, i32 %A, i32 %B, i32 %C ) ; <i32> [#uses=1]
30 %tmp5 = load i32* %Y ; <i32> [#uses=1]
31 %tmp56 = zext i32 %tmp5 to i64 ; <i64> [#uses=1]
32 %tmp7 = shl i64 %tmp56, 32 ; <i64> [#uses=1]
33 %tmp89 = zext i32 %tmp4 to i64 ; <i64> [#uses=1]
34 %tmp10 = or i64 %tmp7, %tmp89 ; <i64> [#uses=1]
35 ret i64 %tmp10
36}