Project

General

Profile

Actions

Bug #5764

closed

Format output of 64-bit values

Added by Mikhail Chupilko over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Andrei Tatarnikov
Category:
-
Target version:
Start date:
03/26/2015
Due date:
% Done:

100%

Estimated time:
Detected in build:
2.2.0-alpha-150324
Platform:
Published in build:
150423

Description

Arguments for format output have been found out to be prepared by means of intValue() despite their length.
E.g., the following syntax will print only lower 32 bits of imm16 inverse.

syntax = format("mov %s, #%016x", rd.syntax, ~(coerce(card(64), imm16)))

Actions #1

Updated by Alexander Kamkin over 9 years ago

  • Priority changed from High to Urgent
Actions #2

Updated by Andrei Tatarnikov over 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Made a fix: r3391. Is it now better?

Actions #3

Updated by Mikhail Chupilko over 9 years ago

  • Status changed from Resolved to New

Not yet. The argument for 64-bit output is a bit more difficult than the one in the first post.

Results for imm16=0xa, shift=1: not inverted 64-bit value: 0xa0000, inverted: 0xffffffffffffffff

Generated source code is given below.

/*
 * Copyright (c) ISPRAS
 * 
 * Institute for System Programming of Russian Academy of Sciences
 * 
 * 25 Alexander Solzhenitsyn st. Moscow 109004 Russia
 * 
 * All rights reserved.
 * 
 * This file was automatically generated by MicroTEST based on the
 * information contained in the 'armv8.nml' specification file.
 * 
 * N.B. PLEASE DO NOT MODIFY THIS FILE.
 */

package ru.ispras.microtesk.model.armv8.op;

import java.util.Map;
import ru.ispras.microtesk.model.api.instruction.IOperation;
import ru.ispras.microtesk.model.api.instruction.Operation;
import ru.ispras.microtesk.model.api.type.*;
import ru.ispras.microtesk.model.api.data.*;
import ru.ispras.microtesk.model.api.memory.*;
import ru.ispras.microtesk.model.api.instruction.IAddressingMode;
import ru.ispras.microtesk.model.armv8.mode.*;
import ru.ispras.microtesk.model.api.memory.Location;

import static ru.ispras.microtesk.model.armv8.shared.Shared.*;

public final class mov_movn extends Operation
{
    private static final class Info extends InfoAndRule
    {
        Info()
        {
            super(
               mov_movn.class,
               "mov_movn",
               true,
               new ParamDecls()
                   .declareParam("rd", REG.INFO)
                   .declareParam("imm16", Type.CARD(16))
                   .declareParam("shift", Type.CARD(2)));
        }

        @Override
        public IOperation create(Map<String, Object> args)
        {
            final IAddressingMode rd = (IAddressingMode) getArgument("rd", args);
            final Location imm16 = (Location) getArgument("imm16", args);
            final Location shift = (Location) getArgument("shift", args);

            return new mov_movn(rd, imm16, shift);
        }
    }

    public static final IInfo INFO = new Info();

    private final IAddressingMode rd;
    private final Location imm16;
    private final Location shift;

    public mov_movn(IAddressingMode rd, Location imm16, Location shift)
    {
        assert REG.INFO.isSupported(rd);
        assert Type.CARD(16).equals(imm16.getType());
        assert Type.CARD(2).equals(shift.getType());

        this.rd = rd;
        this.imm16 = imm16;
        this.shift = shift;
    }

    @Override
    public String syntax()
    {
        return String.format("mov %s, #%016x, imm16=%x, shift=%d, imm16ext=%x, shiftext=%x, resultnotinv=%x, result=%x", rd.syntax(), DataEngine.execute(EOperatorID.BIT_NOT, DataEngine.execute(EOperatorID.L_SHIFT, DataEngine.coerce(Type.CARD(64), imm16.load()), DataEngine.coerce(Type.CARD(64), DataEngine.execute(EOperatorID.MUL, DataEngine.coerce(Type.CARD(32), shift.load()), DataEngine.valueOf(Type.CARD(32), 16))))).getRawData().longValue(), imm16.load().getRawData().intValue(), shift.load().getRawData().intValue(), DataEngine.coerce(Type.CARD(64), imm16.load()).getRawData().longValue(), DataEngine.execute(EOperatorID.MUL, DataEngine.coerce(Type.CARD(32), shift.load()), DataEngine.valueOf(Type.CARD(32), 16)).getRawData().intValue(),

  DataEngine.execute(EOperatorID.L_SHIFT,
                     DataEngine.coerce(Type.CARD(64),
                                       imm16.load()),
                     DataEngine.coerce(Type.CARD(64),
                                       DataEngine.execute(EOperatorID.MUL,
                                                          DataEngine.coerce(Type.CARD(32),
                                                                            shift.load()),
                                                          DataEngine.valueOf(Type.CARD(32), 16)
                                                         )
                                      )
                    ).getRawData().longValue(),

DataEngine.execute(
  EOperatorID.BIT_NOT,
  DataEngine.execute(EOperatorID.L_SHIFT,
                     DataEngine.coerce(Type.CARD(64),
                                       imm16.load()),
                     DataEngine.coerce(Type.CARD(64),
                                       DataEngine.execute(EOperatorID.MUL,
                                                          DataEngine.coerce(Type.CARD(32),
                                                                            shift.load()),
                                                          DataEngine.valueOf(Type.CARD(32), 16)
                                                         )
                                      )
                    )
).getRawData().longValue());

    }

    @Override
    public String image()
    {
        return String.format("%d00100101%2d%16s%5s", DataEngine.valueOf(Type.INT(1), 1).getRawData().intValue(), shift.load().getRawData().intValue(), imm16.load().getRawData().toString(), rd.access().load().getRawData().toString());
    }

    @Override
    public void action()
    {
        new movn(rd, imm16, shift).action();
    }
}

Actions #4

Updated by Andrei Tatarnikov over 9 years ago

Bug in BitVector.longValue (Bug #5775).

Actions #5

Updated by Andrei Tatarnikov over 9 years ago

  • Status changed from New to Resolved

Fixed the bug and updated Fortress - r3392.

Actions #6

Updated by Mikhail Chupilko over 9 years ago

  • Status changed from Resolved to Verified

It works!

Actions #7

Updated by Andrei Tatarnikov over 9 years ago

  • Status changed from Verified to Closed
  • Published in build set to 150423
Actions

Also available in: Atom PDF