Bug 165519 - [WASM] Add support for truncation operators
Summary: [WASM] Add support for truncation operators
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-06 23:55 PST by Keith Miller
Modified: 2016-12-07 13:44 PST (History)
5 users (show)

See Also:


Attachments
Patch (41.70 KB, patch)
2016-12-07 00:01 PST, Keith Miller
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2016-12-06 23:55:24 PST
Add support for truncation operators
Comment 1 Keith Miller 2016-12-07 00:01:43 PST
Created attachment 296382 [details]
Patch
Comment 2 Geoffrey Garen 2016-12-07 10:39:06 PST
Comment on attachment 296382 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=296382&action=review

r=me

> Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:1316
> +        // instructions are the same. Otherwise, we subtract need to int64_t::min() convert then add it back.

Otherwise, we need to: subtract int64_t::min(); truncate double to uint64_t; then add back int64_t::min().

> Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:1324
> +        m_assembler.movq_i64r(0x8000000000000000, scratchRegister());

Let's use numeric_limits<int64_t>::min() here instead of 0x8.

> Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:1356
> +        m_assembler.movq_i64r(0x8000000000000000, scratchRegister());

Samesies.

> Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:1043
> +        constant = m_currentBlock->appendNew<ConstDoubleValue>(m_proc, Origin(), bitwise_cast<double>(0x43e0000000000000));

static_cast<double>(numeric_limits<int64_t>::min())

> Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:1108
> +        constant = m_currentBlock->appendNew<ConstFloatValue>(m_proc, Origin(), bitwise_cast<float>(0x5f000000));

static_cast<float>(numeric_limits<int64_t>::min())
Comment 3 Keith Miller 2016-12-07 13:44:27 PST
Committed r209476: <http://trac.webkit.org/changeset/209476>