[llvm] r251811 - TvOS: add missing support for some libcalls.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 2 10:00:00 PST 2015
Author: tnorthover
Date: Mon Nov 2 12:00:00 2015
New Revision: 251811
URL: http://llvm.org/viewvc/llvm-project?rev=251811&view=rev
Log:
TvOS: add missing support for some libcalls.
Modified:
llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
llvm/trunk/test/Transforms/InstCombine/ffs-1.ll
llvm/trunk/test/Transforms/InstCombine/pow-1.ll
Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=251811&r1=251810&r2=251811&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Mon Nov 2 12:00:00 2015
@@ -289,6 +289,7 @@ static void initialize(TargetLibraryInfo
}
break;
case Triple::IOS:
+ case Triple::TvOS:
case Triple::WatchOS:
TLI.setUnavailable(LibFunc::exp10l);
if (!T.isWatchOS() && (T.isOSVersionLT(7, 0) ||
@@ -324,6 +325,7 @@ static void initialize(TargetLibraryInfo
case Triple::Darwin:
case Triple::MacOSX:
case Triple::IOS:
+ case Triple::TvOS:
case Triple::WatchOS:
case Triple::FreeBSD:
case Triple::Linux:
@@ -336,6 +338,11 @@ static void initialize(TargetLibraryInfo
// http://svn.freebsd.org/base/head/lib/libc/string/ffsll.c
// http://www.gnu.org/software/gnulib/manual/html_node/ffsll.html
switch (T.getOS()) {
+ case Triple::Darwin:
+ case Triple::MacOSX:
+ case Triple::IOS:
+ case Triple::TvOS:
+ case Triple::WatchOS:
case Triple::FreeBSD:
case Triple::Linux:
break;
Modified: llvm/trunk/test/Transforms/InstCombine/ffs-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/ffs-1.ll?rev=251811&r1=251810&r2=251811&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/ffs-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/ffs-1.ll Mon Nov 2 12:00:00 2015
@@ -1,9 +1,12 @@
; Test that the ffs* library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
-; RUN: opt < %s -mtriple i386-pc-linux -instcombine -S | FileCheck %s -check-prefix=CHECK-LINUX
-
-target 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-f80:128:128"
+; RUN: opt < %s -mtriple i386-pc-linux -instcombine -S | FileCheck %s -check-prefix=CHECK-FFS
+; RUN: opt -instcombine -mtriple=arm64-apple-ios9.0 -S %s | FileCheck --check-prefix=CHECK-FFS %s
+; RUN: opt -instcombine -mtriple=arm64-apple-tvos9.0 -S %s | FileCheck --check-prefix=CHECK-FFS %s
+; RUN: opt -instcombine -mtriple=thumbv7k-apple-watchos2.0 -S %s | FileCheck --check-prefix=CHECK-FFS %s
+; RUN: opt -instcombine -mtriple=x86_64-apple-macosx10.11 -S %s | FileCheck --check-prefix=CHECK-FFS %s
+; RUN: opt -instcombine -mtriple=x86_64-freebsd-gnu -S %s | FileCheck --check-prefix=CHECK-FFS %s
declare i32 @ffs(i32)
declare i32 @ffsl(i32)
@@ -19,17 +22,17 @@ define i32 @test_simplify1() {
}
define i32 @test_simplify2() {
-; CHECK-LINUX-LABEL: @test_simplify2(
+; CHECK-FFS-LABEL: @test_simplify2(
%ret = call i32 @ffsl(i32 0)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 0
+; CHECK-FFS-NEXT: ret i32 0
}
define i32 @test_simplify3() {
-; CHECK-LINUX-LABEL: @test_simplify3(
+; CHECK-FFS-LABEL: @test_simplify3(
%ret = call i32 @ffsll(i64 0)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 0
+; CHECK-FFS-NEXT: ret i32 0
}
; Check ffs(c) -> cttz(c) + 1, where 'c' is a constant.
@@ -56,45 +59,45 @@ define i32 @test_simplify6() {
}
define i32 @test_simplify7() {
-; CHECK-LINUX-LABEL: @test_simplify7(
+; CHECK-FFS-LABEL: @test_simplify7(
%ret = call i32 @ffsl(i32 65536)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 17
+; CHECK-FFS-NEXT: ret i32 17
}
define i32 @test_simplify8() {
-; CHECK-LINUX-LABEL: @test_simplify8(
+; CHECK-FFS-LABEL: @test_simplify8(
%ret = call i32 @ffsll(i64 1024)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 11
+; CHECK-FFS-NEXT: ret i32 11
}
define i32 @test_simplify9() {
-; CHECK-LINUX-LABEL: @test_simplify9(
+; CHECK-FFS-LABEL: @test_simplify9(
%ret = call i32 @ffsll(i64 65536)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 17
+; CHECK-FFS-NEXT: ret i32 17
}
define i32 @test_simplify10() {
-; CHECK-LINUX-LABEL: @test_simplify10(
+; CHECK-FFS-LABEL: @test_simplify10(
%ret = call i32 @ffsll(i64 17179869184)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 35
+; CHECK-FFS-NEXT: ret i32 35
}
define i32 @test_simplify11() {
-; CHECK-LINUX-LABEL: @test_simplify11(
+; CHECK-FFS-LABEL: @test_simplify11(
%ret = call i32 @ffsll(i64 281474976710656)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 49
+; CHECK-FFS-NEXT: ret i32 49
}
define i32 @test_simplify12() {
-; CHECK-LINUX-LABEL: @test_simplify12(
+; CHECK-FFS-LABEL: @test_simplify12(
%ret = call i32 @ffsll(i64 1152921504606846976)
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 61
+; CHECK-FFS-NEXT: ret i32 61
}
; Check ffs(x) -> x != 0 ? (i32)llvm.cttz(x) + 1 : 0.
@@ -111,24 +114,24 @@ define i32 @test_simplify13(i32 %x) {
}
define i32 @test_simplify14(i32 %x) {
-; CHECK-LINUX-LABEL: @test_simplify14(
+; CHECK-FFS-LABEL: @test_simplify14(
%ret = call i32 @ffsl(i32 %x)
-; CHECK-LINUX-NEXT: [[CTTZ:%[a-z0-9]+]] = call i32 @llvm.cttz.i32(i32 %x, i1 true)
-; CHECK-LINUX-NEXT: [[INC:%[a-z0-9]+]] = add nuw nsw i32 [[CTTZ]], 1
-; CHECK-LINUX-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 %x, 0
-; CHECK-LINUX-NEXT: [[RET:%[a-z0-9]+]] = select i1 [[CMP]], i32 [[INC]], i32 0
+; CHECK-FFS-NEXT: [[CTTZ:%[a-z0-9]+]] = call i32 @llvm.cttz.i32(i32 %x, i1 true)
+; CHECK-FFS-NEXT: [[INC:%[a-z0-9]+]] = add nuw nsw i32 [[CTTZ]], 1
+; CHECK-FFS-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i32 %x, 0
+; CHECK-FFS-NEXT: [[RET:%[a-z0-9]+]] = select i1 [[CMP]], i32 [[INC]], i32 0
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 [[RET]]
+; CHECK-FFS-NEXT: ret i32 [[RET]]
}
define i32 @test_simplify15(i64 %x) {
-; CHECK-LINUX-LABEL: @test_simplify15(
+; CHECK-FFS-LABEL: @test_simplify15(
%ret = call i32 @ffsll(i64 %x)
-; CHECK-LINUX-NEXT: [[CTTZ:%[a-z0-9]+]] = call i64 @llvm.cttz.i64(i64 %x, i1 true)
-; CHECK-LINUX-NEXT: [[INC:%[a-z0-9]+]] = add nuw nsw i64 [[CTTZ]], 1
-; CHECK-LINUX-NEXT: [[TRUNC:%[a-z0-9]+]] = trunc i64 [[INC]] to i32
-; CHECK-LINUX-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i64 %x, 0
-; CHECK-LINUX-NEXT: [[RET:%[a-z0-9]+]] = select i1 [[CMP]], i32 [[TRUNC]], i32 0
+; CHECK-FFS-NEXT: [[CTTZ:%[a-z0-9]+]] = call i64 @llvm.cttz.i64(i64 %x, i1 true)
+; CHECK-FFS-NEXT: [[INC:%[a-z0-9]+]] = add nuw nsw i64 [[CTTZ]], 1
+; CHECK-FFS-NEXT: [[TRUNC:%[a-z0-9]+]] = trunc i64 [[INC]] to i32
+; CHECK-FFS-NEXT: [[CMP:%[a-z0-9]+]] = icmp ne i64 %x, 0
+; CHECK-FFS-NEXT: [[RET:%[a-z0-9]+]] = select i1 [[CMP]], i32 [[TRUNC]], i32 0
ret i32 %ret
-; CHECK-LINUX-NEXT: ret i32 [[RET]]
+; CHECK-FFS-NEXT: ret i32 [[RET]]
}
Modified: llvm/trunk/test/Transforms/InstCombine/pow-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pow-1.ll?rev=251811&r1=251810&r2=251811&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pow-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/pow-1.ll Mon Nov 2 12:00:00 2015
@@ -6,6 +6,8 @@
; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefix=CHECK-NO-EXP10
; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefix=CHECK-NO-EXP10
; RUN: opt -instcombine -S < %s -mtriple=x86_64-netbsd | FileCheck %s --check-prefix=CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-tvos9.0 | FileCheck %s --check-prefix=CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-watchos2.0 | FileCheck %s --check-prefix=CHECK-EXP10
; rdar://7251832
; NOTE: The readonly attribute on the pow call should be preserved
More information about the llvm-commits
mailing list