Set default CPU for s390x to support conversion between unsigned integers and floating point numbers (#9647)

This commit is contained in:
Vivian Kong
2017-07-13 14:20:25 -04:00
committed by Jordan Rose
parent 4d70a7c4c5
commit 7fe35b4d78
3 changed files with 15 additions and 0 deletions

View File

@@ -682,6 +682,8 @@ addCommonInvocationArguments(std::vector<std::string> &invocationArgStrs,
triple.getArch() == llvm::Triple::aarch64_be) {
invocationArgStrs.push_back("-mcpu=cyclone");
}
} else if (triple.getArch() == llvm::Triple::systemz) {
invocationArgStrs.push_back("-march=z196");
}
const std::string &overrideResourceDir = importerOpts.OverrideResourceDir;

View File

@@ -0,0 +1,10 @@
// RUN: %target-swift-frontend -parse-stdlib -emit-assembly %s -o - | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu
// test converting floating point to unsigned integer
import Swift
let f = -123.0 as Float
let x = Builtin.fptoui_FPIEEE32_Int8(f._value)
// CHECK-NOT: (dummy CHECK line to avoid FileCheck complaints)
// CHECK-s390x: clfebr %r{{[0-9]+}}, {{[0-7]+}}, %f{{[0-9]+}}, {{[0-9]+}}

View File

@@ -37,3 +37,6 @@
// RUN: not %swift -typecheck -target x86_64-apple-watchos2 -Xcc -### %s 2>&1 | %FileCheck -check-prefix=WATCHSIMULATOR64_CPU %s
// WATCHSIMULATOR64_CPU: "-target-cpu" "core2"
// RUN: not %swift -typecheck -target s390x-unknown-linux-gnu -Xcc -### %s 2>&1 | %FileCheck -check-prefix=S390X_CPU %s
// S390X_CPU: "-target-cpu" "z196"