summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-05-26 12:04:39 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-05-26 12:04:39 +0800
commit74759c0172a4aac97a3f628e3adc92c3cdb731f3 (patch)
tree57d27c2314a979b8c9e69e3b4323560fe9ed420f
parent9b601b5e953d0b576d1cb9c3bf91305cab95d0b1 (diff)
downloadmrust-74759c0172a4aac97a3f628e3adc92c3cdb731f3.tar.gz
Codegen C - Handle signed bswap
-rw-r--r--Makefile15
-rw-r--r--src/trans/codegen_c.cpp8
2 files changed, 12 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index a7b3010d..498a6b8e 100644
--- a/Makefile
+++ b/Makefile
@@ -372,8 +372,6 @@ DISABLED_TESTS += run-pass/out-of-stack
# - Requires jemalloc
DISABLED_TESTS += run-pass/allocator-default
DISABLED_TESTS += run-pass/allocator-override
-# - Bug in inferrence order.
-DISABLED_TESTS += run-pass/associated-types-conditional-dispatch
# - Lazy.
DISABLED_TESTS += run-pass/associated-types-projection-in-where-clause # Not normalizing bounds
DISABLED_TESTS += run-pass/cast # Disallows cast from char to i32
@@ -431,27 +429,24 @@ DISABLED_TESTS += run-pass/regions-infer-borrow-scope-addr-of # Didn't unify lit
DISABLED_TESTS += run-pass/swap-2 # ^
DISABLED_TESTS += run-pass/slice_binary_search # Didn't detect infer possiblity (&str, &String)
# - Lazy (Typecheck - Array unsize)
+DISABLED_TESTS += run-pass/associated-types-conditional-dispatch # Ran through coercion point
DISABLED_TESTS += run-pass/byte-literals # Over-eager inferrence
DISABLED_TESTS += run-pass/never_coercions # Over-eager inferrence (ran through coercion)
DISABLED_TESTS += run-pass/cast-rfc0401-vtable-kinds # Spare rules (struct Unsize)
DISABLED_TESTS += run-pass/dst-struct-sole # ^
DISABLED_TESTS += run-pass/dst-struct # ^
DISABLED_TESTS += run-pass/issue-23261 # ^
-DISABLED_TESTS += run-pass/cast-rfc0401 # Skipped coerce unsized
-DISABLED_TESTS += run-pass/fat-ptr-cast # Skipped coerce unsized
-DISABLED_TESTS += run-pass/issue-21562 # Skipped coerce unsized - ERROR - Borrow->Pointer and Unsize in one
+DISABLED_TESTS += run-pass/cast-rfc0401 # Skipped coerce unsized - Cast to raw pointer causing unsize
+DISABLED_TESTS += run-pass/fat-ptr-cast # Skipped coerce unsized - ERROR - coerce Borrow->Pointer and Unsize in one
+DISABLED_TESTS += run-pass/issue-21562 # ^
DISABLED_TESTS += run-pass/mir_raw_fat_ptr # ^
DISABLED_TESTS += run-pass/raw-fat-ptr # ^
-## - Lazy (Typecheck + Trait unsize)
-#DISABLED_TESTS += run-pass/issue-27105
-#DISABLED_TESTS += run-pass/dst-coerce-rc
+## - Lazy (Typecheck - Trait unsize)
DISABLED_TESTS += run-pass/dst-coercions # Skipped CoerceUnsize
DISABLED_TESTS += run-pass/dst-raw # Skipped CoerceUnsize
DISABLED_TESTS += run-pass/issue-11677 # Skipped
-#DISABLED_TESTS += run-pass/dst-trait
# - Lazy (MIR)
DISABLED_TESTS += run-pass/if-ret # If condition wasn't a bool
-DISABLED_TESTS += run-pass/intrinsics-integer # todo - bswap<i8>
DISABLED_TESTS += run-pass/issue-11940 # todo: Match literal Borrow
DISABLED_TESTS += run-pass/mir_build_match_comparisons # - ^
DISABLED_TESTS += run-pass/issue-18352 # - ^
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
index 5ea03eca..7a46306d 100644
--- a/src/trans/codegen_c.cpp
+++ b/src/trans/codegen_c.cpp
@@ -195,7 +195,8 @@ namespace {
// TODO: use a formatter specific to shell escaping
cmd_ss << "\"" << FmtEscaped(arg) << "\" ";
}
- DEBUG("- " << cmd_ss.str());
+ //DEBUG("- " << cmd_ss.str());
+ ::std::cout << "Running comamnd - " << cmd_ss.str() << ::std::endl;
if( system(cmd_ss.str().c_str()) )
{
abort();
@@ -2194,18 +2195,23 @@ namespace {
switch( ty.m_data.as_Primitive() )
{
case ::HIR::CoreType::U8:
+ case ::HIR::CoreType::I8:
emit_lvalue(e.ret_val); m_of << " = "; emit_param(e.args.at(0));
break;
case ::HIR::CoreType::U16:
+ case ::HIR::CoreType::I16:
emit_lvalue(e.ret_val); m_of << " = __builtin_bswap16("; emit_param(e.args.at(0)); m_of << ")";
break;
case ::HIR::CoreType::U32:
+ case ::HIR::CoreType::I32:
emit_lvalue(e.ret_val); m_of << " = __builtin_bswap32("; emit_param(e.args.at(0)); m_of << ")";
break;
case ::HIR::CoreType::U64:
+ case ::HIR::CoreType::I64:
emit_lvalue(e.ret_val); m_of << " = __builtin_bswap64("; emit_param(e.args.at(0)); m_of << ")";
break;
case ::HIR::CoreType::U128:
+ case ::HIR::CoreType::I128:
emit_lvalue(e.ret_val); m_of << " = __builtin_bswap128("; emit_param(e.args.at(0)); m_of << ")";
break;
default: