Instruction conversion program, instruction conversion method, and instruction conversion device

Through an instruction conversion method, the problem of source code compatibility between different CPU types is solved, and the conversion from one CPU type assembly language source code to another CPU type assembly language source code is realized, ensuring that the generated executable file can run correctly.

JP7662940B2Active Publication Date: 2025-04-16FUJITSU LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2021135232
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-08-20
Publication Date
2025-04-16
Estimated Expiration
2041-08-20

AI Technical Summary

Technical Problem

The prior art is difficult to generate executable files that conform to a particular CPU type, especially the conversion from one CPU type assembly language source code to another CPU type assembly language source code.

Method used

Through an instruction conversion method, the specific steps include: identifying the load instruction of the first CPU type and converting it into the load instruction of the second CPU type; if there is a SIMD instruction using the mask register of the first CPU type, the SIMD instruction is converted to adapt to the second CPU type, and it is possible to add instructions to change the mask register value to ensure the state matches.

Benefits of technology

It realizes converting instructions in the source code according to the executable format of the target CPU, solving the source code compatibility problem between different CPU types, and ensuring that the generated executable file can run correctly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007662940000001
    Figure 0007662940000001
  • Figure 0007662940000002
    Figure 0007662940000002
  • Figure 0007662940000003
    Figure 0007662940000003
Patent Text Reader

Abstract

To convert an instruction contained in a source code according to an execution format corresponding to a type of a processor.SOLUTION: An instruction conversion apparatus 100 converts a first load instruction for a first mask register 110 owned by a first type CPU 101 in a first source code 105 into a second load instruction for a second mask register 120 owned by a second type CPU 102. The instruction conversion apparatus 100 determines whether or not a state of a value of the first mask register 110 requested by a first SIMD instruction existing after the first load instruction in the first source code 105 matches the state of the value of the first mask register 110. If there is no match, the instruction conversion apparatus 100 converts the first SIMD instruction into a second SIMD instruction corresponding to the second type CPU 102 and a change instruction that changes a state of a value of the second mask register 120.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to an instruction conversion program, an instruction conversion method, and an instruction conversion device. [Background technology]

[0002] Conventionally, there is a technique for generating an executable file in an executable format corresponding to a certain type of CPU (Central Processing Unit) based on source code. For example, if source code is written in a low-level language such as assembly language corresponding to a certain type of CPU, an assembler corresponding to the type of CPU is used to generate an executable file in an executable format corresponding to the type of CPU based on the source code.

[0003] Prior art techniques include, for example, copying data from successive vector elements of a source vector to unmasked vector elements of a destination vector in response to receiving a processor instruction. [Prior art documents] [Patent documents]

[0004] [Patent Document 1] JP 2014-130580 A Summary of the Invention [Problem to be solved by the invention]

[0005] However, in the conventional technology, it may be difficult to generate an executable file in an executable format corresponding to a specific CPU type. For example, when a source code is written in a low-level language such as assembly language corresponding to a certain CPU type, it is difficult to generate an executable file in an executable format corresponding to a different CPU type.

[0006] In one aspect, the present invention aims to convert instructions contained in source code into an execution format corresponding to the type of processor. [Means for solving the problem]

[0007] According to one embodiment, an instruction conversion program, an instruction conversion method, and an instruction conversion device are proposed which convert a first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor into a second load instruction for a second mask register of a second type of processor different from the first type, and if a first SIMD (Single Instruction Multiple Data) instruction that performs an operation using the first mask register exists after the first load instruction in the first source code, and the value state of the first mask register requested by the first SIMD instruction does not match the value state of the first mask register, convert the first SIMD instruction into a second SIMD instruction corresponding to the second type of processor and a change instruction that changes the value state of the second mask register to the value state of the second mask register requested by the second SIMD instruction. Effect of the Invention

[0008] According to one aspect, it is possible to convert instructions contained in source code to an execution format corresponding to the type of processor. [Brief description of the drawings]

[0009] [Figure 1] FIG. 1 is a diagram illustrating an example of an instruction conversion method according to an embodiment. [Diagram 2] FIG. 2 is a diagram illustrating an example of a source code conversion system 200. As shown in FIG. [Diagram 3] FIG. 3 is a block diagram showing an example of a hardware configuration of the instruction conversion device 100. As shown in FIG. [Figure 4] FIG. 4 is an explanatory diagram showing an example of the contents stored in the line information management table 400. As shown in FIG. [Diagram 5] FIG. 5 is an explanatory diagram showing an example of the contents stored in the mask register information management table 500. As shown in FIG. [Figure 6] FIG. 6 is a block diagram showing an example of a functional configuration of the instruction conversion device 100. As shown in FIG. [Figure 7] FIG. 7 is an explanatory diagram (part 1) showing an example of a SIMD instruction. [Figure 8] FIG. 8 is an explanatory diagram (part 2) showing an example of a SIMD instruction. [Figure 9] FIG. 9 is an explanatory diagram (part 3) showing an example of a SIMD instruction. [Figure 10] FIG. 10 is an explanatory diagram (part 4) showing an example of a SIMD instruction. [Figure 11] FIG. 11 is an explanatory diagram (part 5) showing an example of a SIMD instruction. [Figure 12] FIG. 12 is an explanatory diagram (part 6) showing an example of a SIMD instruction. [Figure 13] FIG. 13 is an explanatory diagram (part 7) showing an example of a SIMD instruction. [Figure 14] FIG. 14 is an explanatory diagram (part 1) showing an example of a load instruction. [Figure 15] FIG. 15 is an explanatory diagram (part 2) showing an example of a load instruction. [Figure 16] FIG. 16 is an explanatory diagram (part 1) showing a first operation example of the instruction conversion device 100. [Figure 17] FIG. 17 is an explanatory diagram (part 2) showing the first operation example of the instruction conversion device 100. [Figure 18] FIG. 18 is an explanatory diagram (part 3) showing the first operation example of the instruction conversion device 100. [Figure 19] FIG. 19 is an explanatory diagram (part 4) showing the first operation example of the instruction conversion device 100. [Figure 20] FIG. 20 is an explanatory diagram (part 5) showing the first operation example of the instruction conversion device 100. [Figure 21] FIG. 21 is an explanatory diagram (part 6) showing the first operation example of the instruction conversion device 100. [Figure 22]FIG. 22 is an explanatory diagram (part 7) showing the first operation example of the instruction conversion device 100. [Figure 23] FIG. 23 is an explanatory diagram (part 8) showing the first operation example of the instruction conversion device 100. [Figure 24] FIG. 24 is an explanatory diagram (part 9) showing the first operation example of the instruction conversion device 100. [Diagram 25] FIG. 25 is an explanatory diagram (part 10) showing the first operation example of the instruction conversion device 100. [Figure 26] FIG. 26 is an explanatory diagram (part 11) showing a first operation example of the instruction conversion device 100. [Figure 27] FIG. 27 is an explanatory diagram (part 12) showing the first operation example of the instruction conversion device 100. [Figure 28] FIG. 28 is an explanatory diagram (part 13) showing a first operation example of the instruction conversion device 100. [Figure 29] FIG. 29 is an explanatory diagram (part 14) showing a first operation example of the instruction conversion device 100. [Diagram 30] FIG. 30 is an explanatory diagram (part 15) showing the first operation example of the instruction conversion device 100. [Diagram 31] FIG. 31 is an explanatory diagram (part 16) showing the first operation example of the instruction conversion device 100. [Diagram 32] FIG. 32 is an explanatory diagram (part 17) showing the first operation example of the instruction conversion device 100. [Diagram 33] FIG. 33 is an explanatory diagram (part 1) showing a second operation example of the instruction conversion device 100. [Diagram 34] FIG. 34 is an explanatory diagram (part 2) showing a second operation example of the instruction conversion device 100. [Diagram 35] FIG. 35 is an explanatory diagram (part 3) showing a second operation example of the instruction conversion device 100. [Diagram 36] FIG. 36 is an explanatory diagram (part 4) showing a second operation example of the instruction conversion device 100. [Figure 37] FIG. 37 is an explanatory diagram (part 5) showing a second operation example of the instruction conversion device 100. [Figure 38]FIG. 38 is an explanatory diagram (part 6) showing the second operation example of the instruction conversion device 100. [Figure 39] FIG. 39 is an explanatory diagram (part 7) showing the second operation example of the instruction conversion device 100. [Diagram 40] FIG. 40 is an explanatory diagram (part 8) showing the second operation example of the instruction conversion device 100. [Diagram 41] FIG. 41 is an explanatory diagram (part 9) showing the second operation example of the instruction conversion device 100. [Diagram 42] FIG. 42 is an explanatory diagram (part 10) showing a second operation example of the instruction conversion device 100. [Diagram 43] FIG. 43 is an explanatory diagram (part 11) showing a second operation example of the instruction conversion device 100. [Diagram 44] FIG. 44 is an explanatory diagram (part 12) showing a second operation example of the instruction conversion device 100. [Diagram 45] FIG. 45 is an explanatory diagram (part 13) showing a second operation example of the instruction conversion device 100. [Figure 46] FIG. 46 is an explanatory diagram (part 14) showing a second operation example of the instruction conversion device 100. [Figure 47] FIG. 47 is an explanatory diagram (part 15) showing a second operation example of the instruction conversion device 100. [Figure 48] FIG. 48 is an explanatory diagram (part 16) showing a second operation example of the instruction conversion device 100. [Figure 49] FIG. 49 is an explanatory diagram (part 17) showing the second operation example of the instruction conversion device 100. [Figure 50] FIG. 50 is a flowchart illustrating an example of an overall processing procedure. [Figure 51] FIG. 51 is a flowchart illustrating an example of a procedure of the first loop process. [Figure 52] FIG. 52 is a flowchart (part 1) illustrating an example of the second loop process procedure. [Figure 53] FIG. 53 is a flowchart (part 2) illustrating an example of the second loop processing procedure. [Figure 54]FIG. 54 is a flowchart (part 3) illustrating an example of the second loop process procedure. [Figure 55] FIG. 55 is a flowchart (part 4) illustrating an example of the second loop process procedure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0010] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, an embodiment of an instruction conversion program, an instruction conversion method, and an instruction conversion device according to the present invention will be described in detail with reference to the drawings.

[0011] (An example of an instruction conversion method according to an embodiment) 1 is an explanatory diagram showing an example of an instruction conversion method according to an embodiment. The instruction conversion device 100 is a computer for converting instructions included in a source code according to an execution format corresponding to a type of processor. The instruction conversion device 100 is, for example, a server or a PC (Personal Computer).

[0012] The processor is, for example, a CPU. In the following description, the case where the processor is a "CPU" will be mainly described. The type of CPU corresponds to the type of instruction set that the CPU has. The type of CPU is, for example, IA (Intel Architecture)-64, AMD (Advanced Micro Devices), or Armv8-A. The instruction set belongs to, for example, an assembly language. The source code is written in, for example, an assembly language. The source code is specifically written by instructions of an instruction set corresponding to the type of CPU. The execution format corresponds to the instruction set.

[0013] Conventionally, if source code is written in a low-level language such as assembly language corresponding to a first CPU type, an executable file in an executable format corresponding to the first CPU type can be generated based on the source code using an assembler corresponding to the first CPU type.

[0014] In response to this, a developer may wish to generate an executable file in an executable format compatible with a second CPU type different from the first CPU type.

[0015] However, it is conventionally difficult to generate an executable file in an executable format compatible with the second CPU type. For example, source code written in an assembly language compatible with the first CPU type cannot be correctly recognized by an assembler compatible with the second CPU type. For this reason, it is not possible to generate an executable file in an executable format compatible with the second CPU type based on the source code.

[0016] Therefore, it is desirable to be able to convert source code written in an assembly language corresponding to a first CPU type into source code written in an assembly language corresponding to a second CPU type in accordance with an execution format corresponding to the second CPU type.

[0017] Conventionally, it is difficult to convert source code written in an assembly language corresponding to a first CPU type into source code written in an assembly language corresponding to a second CPU type. For example, there may be cases where the rules for using a mask register in the assembly language corresponding to the first CPU type differ from the rules for using a mask register in the assembly language corresponding to the second CPU type.

[0018] In this case, the SIMD instructions in the assembly language corresponding to the first CPU type cannot be simply replaced with SIMD instructions in the assembly language corresponding to the second CPU type, and therefore the source code written in the assembly language corresponding to the first CPU type cannot be converted into source code written in the assembly language corresponding to the second CPU type.

[0019] In this embodiment, therefore, an instruction conversion method capable of converting instructions contained in source code to match an execution format corresponding to the type of CPU will be described.

[0020] 1, there are a first type of CPU 101 and a second type of CPU 102. The first type of CPU 101 and the second type of CPU 102 each have a different instruction set. There is an assembler 103 corresponding to the first type of CPU 101 and an assembler 104 corresponding to the second type of CPU 102.

[0021] The first type CPU 101 has one or more mask registers. The first type CPU 101 has, for example, a first mask register 110. The second type CPU 102 has one or more mask registers. The second type CPU 102 has, for example, a second mask register 120.

[0022] The usage rules of the mask register by the first type CPU 101 may differ from the usage rules of the mask register by the second type CPU 102. The usage rules indicate, for example, which bit of the mask register value is to be used depending on the state of the mask register value. The state of the value indicates, for example, how many bits of the value are to be used.

[0023] The instruction conversion device 100 acquires a first source code 105 corresponding to a first type of CPU 101. The instruction conversion device 100 acquires the first source code 105 corresponding to the first type of CPU 101 by accepting an input of the first source code 105 corresponding to the first type of CPU 101 based on, for example, an operational input by a user.

[0024] The first source code 105 is written in, for example, an assembly language corresponding to the first type of CPU 101. Specifically, the first source code 105 is written using an instruction set corresponding to the first type of CPU 101. The first source code 105 can be correctly recognized by, for example, an assembler 103. The assembler 103 can generate an executable file 106 corresponding to the first type of CPU 101 based on, for example, the first source code 105. The executable file 106 can be executed by, for example, the first type of CPU 101.

[0025] On the other hand, the first source code 105 cannot be correctly recognized by, for example, the assembler 104. The assembler 104 cannot generate, for example, the executable file 107 corresponding to the second type of CPU 102 based on the first source code 105. Therefore, there is a case where it is required to generate the second source code 108 written using an instruction set corresponding to the second type of CPU 102 so that the executable file 107 can be generated.

[0026] (1-1) The instruction conversion device 100 identifies a first load instruction for the first mask register 110 of the first type CPU 101 from the first source code 105. In the drawings and in the following description, load may be expressed as "LD(LoaD)". The first load instruction is written, for example, in an instruction set of the first type CPU 101. The instruction conversion device 100 converts the identified first load instruction into a second load instruction for the second mask register 120 of the second type CPU 102. The second load instruction is written, for example, in an instruction set of the second type CPU 102.

[0027] (1-2) The instruction conversion device 100 identifies a first SIMD instruction if a first SIMD instruction that performs an operation using the first mask register 110 is present after the first load instruction in the first source code 105. The instruction conversion device 100 determines whether or not the value state of the first mask register 110 required by the identified first SIMD instruction matches the value state of the first mask register 110. Here, if they match, the instruction conversion device 100 converts the first SIMD instruction into a second SIMD instruction corresponding to the second type of CPU 102. The second SIMD instruction is described, for example, in an instruction set possessed by the second type of CPU 102.

[0028] On the other hand, if there is no match, the instruction conversion device 100 converts the first SIMD instruction into a second SIMD instruction corresponding to the second type CPU 102 and a modification instruction for modifying the state of the value of the second mask register 120. The modification instruction modifies the state of the value of the second mask register 120 to the state of the value of the second mask register 120 requested by the second SIMD instruction. The modification instruction is written, for example, in an instruction set possessed by the second type CPU 102.

[0029] (1-3) The instruction conversion device 100 may further convert other instructions in the first source code 105 that are neither load instructions nor SIMD instructions into instructions that realize the same function as the other instructions and are compatible with the second type of CPU 102. The instruction conversion device 100 may complete the second source code 108 by inserting various converted instructions into an empty second source code 108. The instruction conversion device 100 may also convert the first source code 105 into the second source code 108 by overwriting various pre-conversion instructions included in the first source code 105 with various converted instructions.

[0030] This allows the instruction conversion device 100 to convert the instructions included in the first source code 105 into an execution format compatible with the second type of CPU 102, and generate the second source code 108. Therefore, the instruction conversion device 100 can generate the second source code 108 written using an instruction set compatible with the second type of CPU 102 so as to be able to generate the executable file 107. The instruction conversion device 100 can generate the executable file 107 based on the generated second source code 108.

[0031] Here, the case has been described where the instruction conversion device 100 operates independently and receives the input of the first source code 105 corresponding to the first type of CPU 101, but the present invention is not limited to this. For example, the instruction conversion device 100 may cooperate with another computer and obtain the first source code 105 corresponding to the first type of CPU 101 by receiving it from the other computer.

[0032] Here, a case has been described in which the instruction conversion device 100 operates independently and generates the executable file 107 based on the second source code 108 corresponding to the second type of CPU 102, but the present invention is not limited to this. For example, the instruction conversion device 100 may cooperate with another computer and transmit the second source code 108 corresponding to the second type of CPU 102 to the other computer. In this case, the other computer generates the executable file 107 based on the generated second source code 108. A specific example of the instruction conversion device 100 cooperating with another computer will be described later with reference to FIG. 2.

[0033] (An example of a source code conversion system 200) Next, an example of a source code conversion system 200 to which the instruction conversion device 100 shown in FIG. 1 is applied will be described with reference to FIG.

[0034] 2 is an explanatory diagram showing an example of a source code conversion system 200. In FIG. 2, the source code conversion system 200 includes the instruction conversion device 100, a first client device 201, and a second client device 202.

[0035] In the source code conversion system 200, the instruction conversion device 100 and the first client device 201 are connected via a wired or wireless network 210. The network 210 is, for example, a local area network (LAN), a wide area network (WAN), the Internet, etc. In the source code conversion system 200, the instruction conversion device 100 and the second client device 202 are connected via the wired or wireless network 210.

[0036] The instruction conversion device 100 receives a first source code corresponding to an IA-64 CPU from a first client device 201. The instruction conversion device 100 analyzes the first source code corresponding to the IA-64 CPU and generates various tables described later in FIG. 4 and FIG. 5.

[0037] The instruction conversion device 100 generates a line information management table 400 (described later in Fig. 4) that records attributes of a load instruction that uses a mask register of an IA-64 CPU or an SIMD instruction from the first source code. The instruction conversion device 100 generates a mask register information management table 500 (described later in Fig. 5) that records the state of a mask register, for example.

[0038] The instruction conversion device 100 generates a second source code corresponding to an Armv8-A CPU based on the first source code by using various tables described later in Fig. 4 and Fig. 5. The instruction conversion device 100 transmits the second source code to the second client device 202. The instruction conversion device 100 is, for example, a server or a PC.

[0039] The first client device 201 is a computer having an IA-64 CPU. The first client device 201 transmits a first source code compatible with the IA-64 CPU to the instruction conversion device 100. The first client device 201 is, for example, a server or a PC.

[0040] The second client device 202 is a computer having an Armv8-A CPU. The second client device 202 receives a second source code corresponding to the Armv8-A CPU from the instruction conversion device 100. The second client device 202 generates and executes an executable file corresponding to the Armv8-A CPU based on the second source code corresponding to the Armv8-A CPU. The second client device 202 is, for example, a server or a PC.

[0041] Here, the case where the command conversion device 100 is a device different from the first client device 201 has been described, but is not limited to this. For example, the command conversion device 100 may have a function as the first client device 201 and may also operate as the first client device 201.

[0042] Here, the case where the instruction conversion device 100 is a device different from the second client device 202 has been described, but is not limited to this. For example, the instruction conversion device 100 may have a function as the second client device 202 and may also operate as the second client device 202.

[0043] (Example of Hardware Configuration of the Instruction Conversion Device 100) Next, an example of a hardware configuration of the command conversion device 100 will be described with reference to FIG.

[0044] Fig. 3 is a block diagram showing an example of a hardware configuration of the instruction conversion device 100. In Fig. 3, the instruction conversion device 100 has a CPU 301, a memory 302, a network I / F (Interface) 303, a recording medium I / F 304, and a recording medium 305. In addition, each component is connected to each other via a bus 300.

[0045] Here, the CPU 301 is responsible for the overall control of the instruction conversion device 100. The memory 302 has, for example, a ROM (Read Only Memory), a RAM (Random Access Memory), and a flash ROM. Specifically, for example, the flash ROM and the ROM store various programs, and the RAM is used as a work area for the CPU 301. The programs stored in the memory 302 are loaded into the CPU 301 to cause the CPU 301 to execute coded processes. The memory 302 stores, for example, various tables, which will be described later with reference to FIGS. 4 and 5.

[0046] The network I / F 303 is connected to the network 210 through a communication line, and is connected to other computers via the network 210. The network I / F 303 manages an internal interface with the network 210, and controls input and output of data from other computers. The network I / F 303 is, for example, a modem or a LAN adapter.

[0047] The recording medium I / F 304 controls reading / writing data from / to the recording medium 305 under the control of the CPU 301. The recording medium I / F 304 is, for example, a disk drive, a solid state drive (SSD), a universal serial bus (USB) port, etc. The recording medium 305 is a non-volatile memory that stores data written under the control of the recording medium I / F 304. The recording medium 305 is, for example, a disk, a semiconductor memory, a USB memory, etc. The recording medium 305 may be detachable from the command conversion device 100.

[0048] In addition to the above-mentioned components, the command conversion device 100 may have, for example, a keyboard, a mouse, a display, a printer, a scanner, a microphone, a speaker, etc. The command conversion device 100 may have a plurality of recording medium I / Fs 304 and recording media 305. The command conversion device 100 may not have the recording medium I / Fs 304 and the recording media 305.

[0049] (Storage contents of line information management table 400) Next, an example of the contents stored in the line information management table 400 will be described with reference to Fig. 4. The line information management table 400 is realized by a storage area such as the memory 302 or the recording medium 305 of the command conversion device 100 shown in Fig. 3.

[0050] 4 is an explanatory diagram showing an example of the contents stored in the line information management table 400. As shown in FIG. 4, the line information management table 400 has fields for line, ID, state, and kind. The line information management table 400 stores line information as record 400-a by setting information in each field for each specific instruction line. a is an arbitrary integer. The specific instruction line is, for example, an instruction line indicating a load instruction or a masked SIMD instruction.

[0051] The line field is set to the number of lines of a particular instruction line included in the assembler source code. The ID field is set to an ID assigned to the mask register used in the instruction line. The state field is set to the value of the mask register. More specifically, the value state is the mask bit width. The kind field is set to the type of the instruction line. For example, the type can be LD, which indicates a load instruction, or SIMD, which indicates a masked SIMD instruction.

[0052] (Storage contents of mask register information management table 500) Next, an example of the contents stored in the mask register information management table 500 will be described with reference to Fig. 5. The mask register information management table 500 is realized by a storage area such as the memory 302 or the recording medium 305 of the instruction conversion device 100 shown in Fig. 3.

[0053] Fig. 5 is an explanatory diagram showing an example of the contents stored in the mask register information management table 500. As shown in Fig. 5, the mask register information management table 500 has fields of ID, used[ID], Reserve[ID], Final_point[ID], Reserved[ID], and State[ID]. The mask register information management table 500 stores mask register information as record 500-b by setting information in each field for each mask register. b is an arbitrary integer.

[0054] The ID field is set to the ID assigned to the mask register. The used[ID] field is set to flag information indicating whether the mask register with the above ID is used in the assembler source code. If the flag information is 1, it indicates that it is used, and if it is 0, it indicates that it is not used.

[0055] The Reserve[ID] field contains the ID' of the mask register to which the value is saved when the value of the mask register with the above ID is saved to another mask register with ID'. The Final_point[ID] field contains the line number of the last instruction line in the assembler source code where the mask register with the above ID is used.

[0056] In the Reserved[ID] field, when the value of another mask register of ID' is saved to the mask register of the ID, the ID' of the mask register from which the value is saved is set. In the State[ID] field, the state of the value of the mask register of the ID is set. Specifically, the state of the value is the mask bit width.

[0057] (Example of Hardware Configuration of First Client Device 201) Specifically, an example of the hardware configuration of the first client device 201 is similar to the example of the hardware configuration of the command conversion device 100 shown in FIG. 3, and therefore a description thereof will be omitted.

[0058] (Example of Hardware Configuration of Second Client Device 202) Specifically, an example of the hardware configuration of the second client device 202 is similar to the example of the hardware configuration of the command conversion device 100 shown in FIG. 3, and therefore a description thereof will be omitted.

[0059] (Example of Functional Configuration of Instruction Conversion Device 100) Next, an example of a functional configuration of the command conversion device 100 will be described with reference to FIG.

[0060] 6 is a block diagram showing an example of a functional configuration of the instruction conversion device 100. The instruction conversion device 100 includes a storage unit 600, an acquisition unit 601, a specification unit 602, a first conversion unit 603, a second conversion unit 604, a third conversion unit 605, and an output unit 606.

[0061] The storage unit 600 is realized by, for example, a storage area such as the memory 302 or the recording medium 305 shown in Fig. 3. In the following, a case where the storage unit 600 is included in the command conversion device 100 will be described, but this is not limiting. For example, the storage unit 600 may be included in a device different from the command conversion device 100, and the stored contents of the storage unit 600 may be referable from the command conversion device 100.

[0062] The acquiring unit 601 to the output unit 606 function as an example of a control unit. Specifically, the acquiring unit 601 to the output unit 606 realize their functions by, for example, causing the CPU 301 to execute a program stored in a storage area such as the memory 302 or the recording medium 305 shown in Fig. 3, or by the network I / F 303. The processing results of each functional unit are stored in, for example, a storage area such as the memory 302 or the recording medium 305 shown in Fig. 3.

[0063] The storage unit 600 stores various information that is referred to or updated in the processing of each functional unit. The storage unit 600 stores, for example, a first source code corresponding to a first type of processor. The first source code is written, for example, in an assembly language corresponding to the first type of processor. Specifically, the first source code is written in an instruction set possessed by the first type of processor. The first type is, for example, IA-64. The first source code is, for example, acquired by an acquisition unit 601 and stored by the storage unit 600.

[0064] The storage unit 600 stores, for example, an instruction set possessed by a first type of processor. The storage unit 600 stores, for example, an instruction set possessed by a second type of processor. The storage unit 600 stores, for example, a rule for converting a first instruction included in the instruction set possessed by the first type of processor into a second instruction of the instruction set possessed by the second type of processor. The various instruction sets and rules are, for example, stored in advance by the storage unit 600.

[0065] The storage unit 600 stores, for example, rules for use of a mask register possessed by a first type of processor by a first type of processor. The storage unit 600 stores, for example, rules for use of a mask register possessed by a second type of processor by a second type of processor. The rules for use of a mask register by a first type of processor and the rules for use of a mask register by a second type of processor are different from each other. The rules for use indicate, for example, which bit of the value of the mask register is to be used depending on the state of the value of the mask register. The state of the value indicates, for example, how many bits of the value are to be used. The state of the value corresponds, for example, to a mask bit width.

[0066] The storage unit 600 stores, for example, position information that enables identification of a position of a load instruction for a mask register of the first type of processor in the first source code. The storage unit 600 stores, for example, position information that enables identification of a position of a SIMD instruction that performs an operation using a mask register of the first type of processor. Specifically, the storage unit 600 stores the line information management table 400. The position information is, for example, generated by the identification unit 602 and stored by the storage unit 600.

[0067] The storage unit 600 may store, for example, a state of a mask register of the first type of processor. The state includes, for example, whether or not the mask register of the first type of processor is used in the first source code. The state may include, for example, a position of a load instruction or a SIMD instruction in the first source code in which the mask register of the first type of processor is last used. The storage unit 600 specifically stores a mask register information management table 500. The state is, for example, generated by the identification unit 602 and stored by the storage unit 600.

[0068] The acquisition unit 601 acquires various information used in the processing of each functional unit. The acquisition unit 601 stores the acquired various information in the storage unit 600 or outputs it to each functional unit. The acquisition unit 601 may also output the various information stored in the storage unit 600 to each functional unit. The acquisition unit 601 acquires various information based on, for example, an operation input by a user. The acquisition unit 601 may receive various information from, for example, a device different from the command conversion device 100.

[0069] The acquiring unit 601 acquires, for example, a first source code. Specifically, the acquiring unit 601 acquires the first source code by accepting an input of the first source code based on an operation input by a user. Specifically, the acquiring unit 601 acquires the first source code by receiving it from another computer. The other computer is, for example, the first client device 201.

[0070] The acquisition unit 601 may receive a start trigger for starting processing of any of the functional units. The start trigger may be, for example, a predetermined operation input by a user. The start trigger may be, for example, reception of predetermined information from another computer. The start trigger may be, for example, output of predetermined information by any of the functional units. Specifically, the acquisition unit 601 receives the acquisition of the first source code as a start trigger for starting processing of the identification unit 602, the first conversion unit 603, the second conversion unit 604, and the third conversion unit 605.

[0071] The identification unit 602 identifies, from the first source code, a load instruction for a mask register of the first type of processor. The identification unit 602, for example, identifies, from the first source code, a first load instruction for a first mask register of the first type of processor. The identification unit 602 may, for example, generate position information that enables identification of the position of the identified first load instruction, and store the position information in the storage unit 600. In this way, the identification unit 602 can make it easier for the first conversion unit 603 to process the first load instruction.

[0072] The identifying unit 602 identifies, from the first source code, a SIMD instruction that performs an operation using a mask register included in the first type of processor. The identifying unit 602, for example, identifies, from the first source code, a first SIMD instruction that performs an operation using a first mask register. The identifying unit 602 may, for example, generate position information that enables identification of the position of the identified first SIMD instruction, and store the position information in the storage unit 600. This allows the identifying unit 602 to make it easier for the second conversion unit 604 to process the first SIMD instruction.

[0073] The identification unit 602 may identify a state of a mask register of the first type of processor. For example, the identification unit 602 identifies a state including whether or not the mask register of the first type of processor is used in the first source code. For example, the identification unit 602 identifies a state including a position of a load instruction or a SIMD instruction that is last used in the first source code, in which the mask register of the first type of processor is used. For example, the identification unit 602 may store the identified state in the storage unit 600. Thereby, the identification unit 602 can make it possible to refer to information that can be a guide when the first conversion unit 603 converts the first load instruction and when the second conversion unit 604 converts the first SIMD instruction.

[0074] The first conversion unit 603 converts a first load instruction for a first mask register of the first type of processor in the first source code. The first conversion unit 603 converts, for example, the first load instruction into a second load instruction for a second mask register of the second type of processor. Specifically, the first conversion unit 603 refers to the storage unit 600 and converts the first load instruction into a second load instruction for a second mask register of the second type of processor. In this way, the first conversion unit 603 can obtain a second load instruction corresponding to the second type of processor, which is written in an assembly language corresponding to the second type of processor.

[0075] More specifically, if a first SIMD instruction is present after the first load instruction in the first source code, the first conversion unit 603 converts the first load instruction into a second load instruction and a save instruction. The save instruction specifies that the value of the second mask register is saved to a third mask register of the second type of processor. This allows the first conversion unit 603 to switch the bits of the value of the second mask register to change the state of the value of the second mask register, and then to restore the bits of the value of the second mask register. Furthermore, if it is not necessary to change the state of the value of the second mask register, the first conversion unit 603 can dispense with the save instruction, reduce the amount of processing, and make it easier to secure a free mask register.

[0076] More specifically, if there is another load instruction for the first mask register after the first load instruction in the first source code, the first conversion unit 603 converts the first load instruction into a second load instruction and a save instruction. The save instruction specifies that the value of the second mask register is saved to a third mask register of the second type of processor. This allows the first conversion unit 603 to restore the bits of the value of the second mask register after changing the state of the value of the second mask register by swapping the bits of the value of the second mask register. Furthermore, if it is not necessary to change the state of the value of the second mask register, the first conversion unit 603 can do without using a save instruction, reduce the amount of processing, and make it easier to secure a free mask register.

[0077] The second conversion unit 604 converts a first SIMD instruction in the first source code that performs an operation using a first mask register. For example, the second conversion unit 604 refers to the storage unit 600 to determine whether or not the first SIMD instruction is present after the first load instruction in the first source code. If the first SIMD instruction is present, the second conversion unit 604 determines whether or not the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register immediately before. The value state of the first mask register immediately before the first SIMD instruction in the first source code is the value state of the first mask register immediately before the first SIMD instruction.

[0078] If there is no match, the second conversion unit 604, for example, refers to the storage unit 600 and converts the first SIMD instruction into a second SIMD instruction corresponding to the second type of processor and a modification instruction. The modification instruction specifies that the value state of the second mask register is to be changed to the value state of the second mask register required by the second SIMD instruction. This allows the second conversion unit 604 to modify the value state of the second mask register so that the second SIMD instruction can be executed correctly.

[0079] For example, if there is a match, the second conversion unit 604 converts the first SIMD instruction into a second SIMD instruction. Specifically, if there is a match, the second conversion unit 604 refers to the storage unit 600 and converts the first SIMD instruction into a second SIMD instruction. In this way, the second conversion unit 604 can obtain a second load instruction corresponding to the second type of processor, which is written in an assembly language corresponding to the second type of processor.

[0080] Specifically, the second conversion unit 604 determines whether or not the value state of the first mask register required by the first SIMD instruction matches the value state of the immediately preceding first mask register. Here, the immediately preceding value state of the first mask register refers to the value state of the first mask register immediately preceding another SIMD instruction in the first source code. Specifically, the second conversion unit 604 determines whether or not there is another SIMD instruction performing an operation using the first mask register after the first SIMD instruction in the first source code. Specifically, when the second conversion unit 604 determines that there is no other SIMD instruction and that there is no match, it converts the first SIMD instruction into a second SIMD instruction and a modification instruction, and releases the third mask register. This makes it easier for the second conversion unit 604 to secure a free mask register.

[0081] Specifically, the second conversion unit 604 determines whether the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register immediately before the first SIMD instruction, where the immediately before value state of the first mask register is the value state of the first mask register immediately before the first SIMD instruction in the first source code.

[0082] Specifically, the second conversion unit 604 identifies a value state of the first mask register required by another SIMD instruction that performs an operation using the first mask register and exists after the first SIMD instruction in the first source code. Specifically, the second conversion unit 604 determines whether or not the identified value state of the first mask register matches the value state of the immediately preceding first mask register. Here, the immediately preceding value state of the first mask register refers to the value state of the first mask register immediately before the other SIMD instruction in the first source code.

[0083] Specifically, it may be determined that the state of the value of the first mask register required by the first SIMD instruction does not match, and the state of the value of the first mask register required by another SIMD instruction matches. In this case, the second conversion unit 604 specifically converts the first SIMD instruction into a second SIMD instruction and a modification instruction, and releases the third mask register. This makes it easier for the second conversion unit 604 to secure a free mask register.

[0084] Specifically, the second conversion unit 604 determines whether the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register. Specifically, the second conversion unit 604 determines whether there are other SIMD instructions performing an operation using the first mask register and other load instructions for the first mask register after the first SIMD instruction in the first source code. Specifically, when the second conversion unit 604 determines that there are no other load instructions and that there is no match, it converts the first SIMD instruction into a second SIMD instruction and a change instruction, and releases the third mask register. This makes it easier for the second conversion unit 604 to secure a free mask register.

[0085] Specifically, the second conversion unit 604 determines whether the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register immediately before the first SIMD instruction, where the immediately before value state of the first mask register is the value state of the first mask register immediately before the first SIMD instruction in the first source code.

[0086] Specifically, the second conversion unit 604 identifies a value state of the first mask register required by another SIMD instruction that performs an operation using the first mask register and exists after the first SIMD instruction in the first source code. Specifically, the second conversion unit 604 determines whether or not the identified value state of the first mask register matches the value state of the immediately preceding first mask register. Here, the immediately preceding value state of the first mask register refers to the value state of the first mask register immediately before the other SIMD instruction in the first source code.

[0087] Specifically, the second conversion unit 604 identifies a value state of the first mask register corresponding to another load instruction present after the first SIMD instruction in the first source code. Specifically, the second conversion unit 604 determines whether or not the identified value state of the first mask register matches the value state of the immediately preceding first mask register. Here, the immediately preceding value state of the first mask register refers to the value state of the first mask register immediately before the other load instruction in the first source code.

[0088] Specifically, it may be determined that the state of the value of the first mask register required by the first SIMD instruction does not match. Furthermore, it may be determined that the state of the value of the first mask register required by another SIMD instruction matches, and the state of the value of the first mask register corresponding to another load instruction matches. In this case, specifically, the second conversion unit 604 converts the first SIMD instruction into a second SIMD instruction and a modification instruction, and releases the third mask register. This makes it easier for the second conversion unit 604 to secure a free mask register.

[0089] The third conversion unit 605 refers to the storage unit 600 and converts an instruction in the first source code that is neither a load instruction nor a SIMD instruction into an instruction corresponding to the second type of processor that realizes a function corresponding to the instruction. In this way, the third conversion unit 605 can obtain an instruction corresponding to the second type of processor that is written in an assembly language corresponding to the second type of processor.

[0090] The output unit 606 outputs the processing result of at least any one of the functional units. The output format is, for example, display on a display, printout on a printer, transmission to an external device via the network I / F 303, or storage in a storage area such as the memory 302 or the recording medium 305. In this way, the output unit 606 can notify the user of the processing result of at least any one of the functional units, thereby improving the convenience of the command conversion device 100.

[0091] The output unit 606 outputs, for example, the second load instruction obtained by the first conversion unit 603. The output unit 606 outputs, for example, the second SIMD instruction obtained by the second conversion unit 604. The output unit 606 outputs, for example, the instruction obtained by the third conversion unit 605. Specifically, the output unit 606 outputs a second source code written in an assembly language corresponding to a second type of processor, including the second load instruction obtained by the first conversion unit 603, the second SIMD instruction obtained by the second conversion unit 604, and the instruction obtained by the third conversion unit 605. In this way, the output unit 606 can make the second source code available.

[0092] (Example of operation of the instruction conversion device 100) Next, an example of the operation of the instruction conversion device 100 will be described with reference to Figures 7 to 49. First, an example of a SIMD instruction will be described with reference to Figures 7 to 13, for example.

[0093] 7 to 13 are explanatory diagrams showing an example of a SIMD instruction. In FIG. 7, an example of a SIMD instruction corresponding to an IA-64 CPU will be described. The IA-64 CPU has 32 512-bit SIMD registers. The SIMD registers are named, for example, zmm0 to zmm31, respectively. The SIMD instruction is an instruction that performs an operation on the value of the SIMD register. The SIMD instruction is included in, for example, an instruction set that the IA-64 CPU has.

[0094] An example of a SIMD instruction is "vpaddb zmm2,zmm0,zmm1." "vpaddb zmm2,zmm0,zmm1" specifies that 64 pieces of 8-bit data in zmm0 are added to 64 pieces of 8-bit data in zmm1, and the result of the addition is stored in zmm2.

[0095] "vpaddb zmm2,zmm0,zmm1" specifies, for example, ci = ai + bi,i = 0,1,...,63. ai is the i-th 8-bit data when zmm0 is divided into 8-bit widths. bi is the i-th 8-bit data when zmm1 is divided into 8-bit widths. ci is the i-th 8-bit data when zmm2 is divided into 8-bit widths.

[0096] An example of a SIMD instruction is "vpaddq zmm2,zmm0,zmm1." "vpaddq zmm2,zmm0,zmm1" specifies that eight 64-bit data items in zmm0 are added to eight 64-bit data items in zmm1, and the result of the addition is stored in zmm2.

[0097] "vpaddq zmm2,zmm0,zmm1" specifies, for example, ci = ai + bi,i = 0,1,...,7. ai is the i-th 64-bit data when zmm0 is divided into 64-bit widths. bi is the i-th 64-bit data when zmm1 is divided into 64-bit widths. ci is the i-th 64-bit data when zmm2 is divided into 64-bit widths.

[0098] Similarly, an example of a SIMD instruction is, for example, "vpaddw zmm2,zmm0,zmm1," or "vpaddd zmm2,zmm0,zmm1," etc. Next, we move on to an explanation of FIG.

[0099] SIMD instructions corresponding to the Armv8-A CPU will be described with reference to FIG. 8. The Armv8-A CPU has 32 512-bit SIMD registers. The SIMD registers are named, for example, z0 to z31. The SIMD instructions are instructions that perform operations on the values ​​of the SIMD registers. The SIMD instructions are included in, for example, the instruction set of the Armv8-A CPU.

[0100] An example of a SIMD instruction is "add z2.b,z0.b,z1.b." "add z2.b,z0.b,z1.b" specifies that 64 pieces of 8-bit data in z0 are added to 64 pieces of 8-bit data in z1, and the result of the operation is stored in z2.

[0101] "add z2.b,z0.b,z1.b" specifies, for example, ci=ai+bi,i=0,1,...,63. ai is the i-th 8-bit data when z0 is divided into 8-bit widths. bi is the i-th 8-bit data when z1 is divided into 8-bit widths. ci is the i-th 8-bit data when z2 is divided into 8-bit widths.

[0102] An example of a SIMD instruction is "add z2.q,z0.q,z1.q." "add z2.q,z0.q,z1.q" specifies that eight pieces of 64-bit data in z0 are added to eight pieces of 64-bit data in z1, and the result of the addition is stored in z2.

[0103] "add z2.q,z0.q,z1.q" specifies, for example, ci=ai+bi,i=0,1,...,7. ai is the i-th 64-bit data when z0 is divided into 64-bit widths. bi is the i-th 64-bit data when z1 is divided into 64-bit widths. ci is the i-th 64-bit data when z2 is divided into 64-bit widths.

[0104] Similarly, an example of a SIMD instruction is, for example, "add z2.h, z0.h, z1.h" or "add z2.d, z0.d, z1.d" etc. Next, moving on to the explanation of Fig. 9 to Fig. 12, an example of a masked SIMD instruction that extends a SIMD instruction using a mask register will be explained.

[0105] 9, a masked SIMD instruction corresponding to an IA-64 CPU will be described. An IA-64 CPU has seven 64-bit mask registers. The mask registers are named, for example, k1 to k7. A masked SIMD instruction is an instruction that uses a mask register to perform an operation on a value of a SIMD register. For example, the masked SIMD instruction is included in an instruction set that an IA-64 CPU has.

[0106] An example of a masked SIMD instruction is "vpaddb zmm2{k1},zmm0,zmm1." "vpaddb zmm2{k1},zmm0,zmm1" specifies that an addition operation is performed on the 64 8-bit data items in zmm0 and the 64 8-bit data items in zmm1, as specified by the mask register, and the operation result is stored in zmm2.

[0107] "vpaddb zmm2{k1},zmm0,zmm1" specifies, for example, if(i-th bit of mask register is 1){ci=ai+bi;}. ai is the i-th 8-bit data when zmm0 is divided into 8-bit widths. bi is the i-th 8-bit data when zmm1 is divided into 8-bit widths. ci is the i-th 8-bit data when zmm2 is divided into 8-bit widths.

[0108] For example, if the i-th bit of the mask register is 0, the i-th 8-bit data of zmm0 and the i-th 8-bit data of zmm1 are not added, and the i-th 8-bit data of zmm2 is not updated. Next, we move on to the explanation of FIG.

[0109] 10, a masked SIMD instruction for IA-64 CPUs will be described. An example of a masked SIMD instruction is "vpaddq zmm2{k1},zmm0,zmm1". "vpaddq zmm2{k1},zmm0,zmm1" specifies that an addition operation is performed between eight 64-bit data in zmm0 and eight 64-bit data in zmm1, as specified by the mask register, and the operation result is stored in zmm2.

[0110] "vpaddq zmm2{k1},zmm0,zmm1" specifies, for example, if(i-th bit of mask register is 1){ci=ai+bi;}. ai is the i-th 64-bit data when zmm0 is divided into 64-bit widths. bi is the i-th 64-bit data when zmm1 is divided into 64-bit widths. ci is the i-th 64-bit data when zmm2 is divided into 64-bit widths.

[0111] For example, if the i-th bit of the mask register is 0, the i-th 64-bit data of zmm0 and the i-th 64-bit data of zmm1 are not added, and the i-th 64-bit data of zmm2 is not updated.

[0112] Similarly, an example of a masked SIMD instruction is, for example, "vpaddw zmm2{k1},zmm0,zmm1," or "vpaddd zmm2{k1},zmm0,zmm1," etc. Next, we move on to the description of FIG.

[0113] In FIG. 11, a masked SIMD instruction corresponding to the Armv8-A CPU will be described. The Armv8-A CPU has 15 64-bit mask registers. The mask registers are named, for example, p0 to p15. The masked SIMD instruction is an instruction that performs an operation on the value of a SIMD register. The masked SIMD instruction is included in, for example, the instruction set of the Armv8-A CPU.

[0114] An example of a masked SIMD instruction is "add z2.b,p0 / M,z0.b,z1.b." "add z2.b,p0 / M,z0.b,z1.b" specifies that an addition operation is performed on the 64 pieces of 8-bit data in z0 and the 64 pieces of 8-bit data in z1, as specified by the mask register, and the operation result is stored in z2.

[0115] "add z2.b,p0 / M,z0.b,z1.b" specifies, for example, if(i-th bit of mask register is 1){ci=ai+bi;}. ai is the i-th 8-bit data when z0 is divided into 8-bit widths. bi is the i-th 8-bit data when z1 is divided into 8-bit widths. ci is the i-th 8-bit data when z2 is divided into 8-bit widths.

[0116] For example, if the i-th bit of the mask register is 0, the i-th 8-bit data of zmm0 and the i-th 8-bit data of zmm1 are not added, and the i-th 8-bit data of zmm2 is not updated. Next, we move on to the explanation of FIG.

[0117] 12, an example of a masked SIMD instruction is "add z2.q,p0 / M,z0.q,z1.q." "add z2.q,p0 / M,z0.q,z1.q" specifies that an addition operation is performed on the eight 64-bit data items in z0 and the eight 64-bit data items in z1, the data items specified by the mask register, and the operation result is stored in z2.

[0118] "add z2.q,p0 / M,z0.q,z1.q" specifies, for example, if(8×i-th ​​bit of mask register is 1){ci=ai+bi;}. ai is the i-th 64-bit data when zmm0 is divided into 64-bit widths. bi is the i-th 64-bit data when zmm1 is divided into 64-bit widths. ci is the i-th 64-bit data when zmm2 is divided into 64-bit widths.

[0119] For example, if the 8×i-th ​​bit of the mask register is 0, the i-th 64-bit data of zmm0 and the i-th 64-bit data of zmm1 are not added, and the i-th 64-bit data of zmm2 is not updated.

[0120] Similarly, an example of a masked SIMD instruction is, for example, "add z2.h, p0 / M, z0.h, z1.h" or "add z2.d, p0 / M, z0.d, z1.d". Next, we move on to the explanation of Figure 13 and explain a comparison between a masked SIMD instruction corresponding to an IA-64 CPU and a masked SIMD instruction corresponding to an Armv8-A CPU.

[0121] As shown in FIG. 13, the masked SIMD instruction "vpaddb zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.b,p0 / M,z0.b,z1.b" refer to the mask register using the same criteria. Therefore, the masked SIMD instruction "vpaddb zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.b,p0 / M,z0.b,z1.b" are considered to be convertible to each other. For example, the operation result of the masked SIMD instruction "vpaddb zmm2{k1},zmm0,zmm1" is considered to be the same as the operation result of the masked SIMD instruction "add z2.b,p0 / M,z0.b,z1.b".

[0122] On the other hand, the masked SIMD instruction "vpaddq zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.q,p0 / M,z0.q,z1.q" refer to the mask register using different standards. For this reason, the masked SIMD instruction "vpaddq zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.q,p0 / M,z0.q,z1.q" are not considered to be convertible to each other. For example, the operation result of the masked SIMD instruction "vpaddq zmm2{k1},zmm0,zmm1" is not considered to match the operation result of the masked SIMD instruction "add z2.q,p0 / M,z0.q,z1.q".

[0123] Similarly, the masked SIMD instruction "vpaddw zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.h,p0 / M,z0.h,z1.h" refer to the mask register using different criteria. For this reason, the masked SIMD instruction "vpaddw zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.h,p0 / M,z0.h,z1.h" are considered to be mutually convertible. For example, the operation result of the masked SIMD instruction "vpaddw zmm2{k1},zmm0,zmm1" is considered to be different from the operation result of the masked SIMD instruction "add z2.h,p0 / M,z0.h,z1.h".

[0124] Similarly, the masked SIMD instruction "vpaddd zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.d,p0 / M,z0.d,z1.d" refer to the mask register using different criteria. For this reason, the masked SIMD instruction "vpaddd zmm2{k1},zmm0,zmm1" and the masked SIMD instruction "add z2.d,p0 / M,z0.d,z1.d" are considered to be mutually convertible. For example, the operation result of the masked SIMD instruction "vpaddd zmm2{k1},zmm0,zmm1" is considered to be different from the operation result of the masked SIMD instruction "add z2.d,p0 / M,z0.d,z1.d".

[0125] Next, an example of a load instruction will be described with reference to FIG. 14 and FIG.

[0126] 14 and 15 are explanatory diagrams showing an example of a load instruction. An example of a load instruction corresponding to an IA-64 CPU will be described with reference to FIG. 14. An example of a load instruction corresponding to an IA-64 CPU is, for example, "kmovb k1, [0x09]". [0x09] is a memory address. The load instruction "kmovb k1, [0x09]" prescribes, for example, that 8-bit data is read from a storage area specified by the memory address, and that the read 8-bit data is set to the 0th to 7th bits of the mask register k1. The load instruction "kmovb k1, [0x09]" prescribes, for example, that 0 is set to the 8th to 63rd bits of the mask register k1.

[0127] An example of a load instruction compatible with an IA-64 CPU is, for example, "kmovw k1,[0x10]". [0x10] is a memory address. The load instruction "kmovw k1,[0x10]" specifies, for example, that 16-bit data is read from a storage area specified by the memory address, and that the read 16-bit data is set to the 0th to 15th bits of mask register k1. The load instruction "kmovw k1,[0x10]" specifies, for example, that 0 is set to the 16th to 63rd bits of mask register k1.

[0128] An example of a load instruction compatible with an IA-64 CPU is, for example, "kmovd k1,[0x14]". [0x14] is a memory address. The load instruction "kmovd k1,[0x14]" specifies, for example, that 32-bit data is read from a storage area specified by the memory address, and that the read 32-bit data is set to the 0th to 31st bits of the mask register k1. The load instruction "kmovd k1,[0x14]" specifies, for example, that 0 is set to the 32nd to 63rd bits of the mask register k1.

[0129] An example of a load instruction corresponding to an IA-64 CPU is, for example, "kmovq k1, [0x18]". [0x18] is a memory address. The load instruction "kmovq k1, [0x18]" specifies, for example, that 64-bit data is read from a storage area specified by the memory address, and the read 64-bit data is set to the 0th to 63rd bits of the mask register k1. In this way, in IA-64, there are multiple load instructions that set bit data of different lengths to the mask register k1. Next, we move on to the explanation of FIG. 15.

[0130] In FIG. 15, an example of a load instruction corresponding to the Armv8-A CPU will be described. An example of a load instruction corresponding to the Armv8-A CPU is, for example, "ldr p1, [x0]". The load instruction "ldr p1, [x0]" specifies that 64-bit data is read from a memory area specified by a memory address, and the read 64-bit data is set to the 0th to 63rd bits of the mask register k1. In this way, in Armv8-A, there is a load instruction that sets 64-bit data to the mask register k1.

[0131] From the above, it is preferable to consider the context of the assembler source code when converting the masked SIMD instruction "vpadd(b|w|d|q)" among IA-64 assembler source codes executable by IA-64 CPUs. Similarly, it is preferable to consider the context of the assembler source code when converting the load instruction "kmov(b|w|d|q)" among IA-64 assembler source codes executable by IA-64 CPUs. Specifically, it is preferable to convert the masked SIMD instruction "vpadd(b|w|d|q)" and the load instruction "kmov(b|w|d|q)" by considering the state of the mask register value in the IA-64 assembler source code.

[0132] Next, a first operation example of the instruction conversion device 100 will be described with reference to FIGS.

[0133] 16 to 32 are explanatory diagrams showing a first operation example of the instruction conversion device 100. In Fig. 16, the instruction conversion device 100 acquires an IA-64 assembler source code 1600 as a conversion target. In the example of Fig. 16, for convenience, instruction lines in the assembler source code 1600 that are neither load instructions nor masked SIMD instructions are omitted.

[0134] In other words, the example of Fig. 16 shows a correspondence between a load instruction and the number of lines of the load instruction in the assembler source code 1600. Also, the example of Fig. 16 shows a correspondence between a masked SIMD instruction and the number of lines of the masked SIMD instruction in the assembler source code 1600. In the following description, the masked SIMD instruction may be simply referred to as a "SIMD instruction." Next, we move on to the description of Figs. 17 and 18.

[0135] 17 and 18, the instruction conversion device 100 prepares to convert an IA-64 assembler source code 1600 into Armv8-A assembler source code executable by an Armv8-A CPU. The instruction conversion device 100, for example, analyzes the IA-64 assembler source code 1600. Specifically, the instruction conversion device 100 analyzes the IA-64 assembler source code 1600 sequentially from the first instruction line. The instruction conversion device 100 generates and updates a line information management table 400 and a mask register information management table 500 based on the analysis result.

[0136] 17, the instruction conversion device 100 associates line=10, ID=0, mask bit width=64, and kind=LD with each other for the load instruction of line=10, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the load instruction of line=10. Furthermore, the instruction conversion device 100 associates mask register ID=0, used[0]=1, and Final_point[0]=10 with each other for the load instruction of line=10, and stores them in the mask register information management table 500.

[0137] 17, the instruction conversion device 100 associates line=11, ID=0, mask bit width=64, and kind=SIMD with each other for the SIMD instruction of line=11, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=11. Furthermore, the instruction conversion device 100 does not need to update Final_point[0] in the mask register information management table 500 because the mask bit width required by the SIMD instruction of line=11 matches the immediately preceding mask bit width.

[0138] Similarly, as shown in table 1700 in Fig. 17, the instruction conversion device 100 updates the line information management table 400 and the mask register information management table 500 for other load instructions and other SIMD instructions. As a result, the line information management table 400 and the mask register information management table 500 become in the state shown in Fig. 18. Next, we move on to the description of Figs. 19 to 32.

[0139] 19 to 32, the instruction conversion device 100 converts each instruction line included in the assembler source code 1600 into an instruction line defined in Armv8-A, using a line information management table 400 and a mask register information management table 500. The instruction conversion device 100 generates Armv8-A assembler source code by inserting the converted instruction lines into empty Armv8-A assembler source code.

[0140] In the following description, for convenience, a case where the instruction conversion device 100 converts an instruction line that is neither a load instruction nor a SIMD instruction will be omitted. In the following description, a case where the instruction conversion device 100 converts a load instruction or a SIMD instruction will be described.

[0141] For example, as shown in table 1900 in FIG. 19, the instruction conversion device 100 processes line=10. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 18 and the mask register information management table 500 shown in FIG. 18, and determines that line=10 is kind=LD and line=Final_point[0]. Since line=Final_point[0], the instruction conversion device 100 determines that the subsequent instruction lines can be executed normally even if the value of the mask register of ID=0 is not saved, and determines that a save instruction to save the value of the mask register is unnecessary. In the drawing, the mask register of ID=x may be written as "mask register #x", where x is an integer equal to or greater than 0.

[0142] Therefore, the instruction conversion device 100 converts the load instruction of line=10 into a load instruction defined in Armv8-A. The converted load instruction is, for example, an instruction line that specifies reading 64 bits from [memory address], which realizes the same function as the load instruction of line=10. The instruction conversion device 100 inserts the converted load instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 20, the instruction conversion device 100 stores State[0]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 21 and FIG. 22.

[0143] For example, as shown in table 2100 in Fig. 21, the instruction conversion device 100 processes line=11. The instruction conversion device 100 determines that line=11 is kind=SIMD and line>Final_point[0] by referring to the line information management table 400 shown in Fig. 20 and the mask register information management table 500 shown in Fig. 20. Since line>Final_point[0], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=0.

[0144] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=11 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies 8-bit x 64 data addition, which realizes the same function as the SIMD instruction of line=11. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 22, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=0, so there is no need to update State[0]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 23 and FIG. 24.

[0145] For example, as shown in table 2300 in Fig. 23, the instruction conversion device 100 processes line=120. The instruction conversion device 100 determines that line=120 is kind=SIMD and line>Final_point[0] by referring to the line information management table 400 shown in Fig. 22 and the mask register information management table 500 shown in Fig. 22. Since line>Final_point[0], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=0.

[0146] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=120 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies 8-bit x 64 data additions that realize the same function as the SIMD instruction of line=120. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 24, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=0, so there is no need to update State[0]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 25 and FIG. 26.

[0147] For example, as shown in table 2500 in Fig. 25, the instruction conversion device 100 processes line=121. The instruction conversion device 100 refers to the line information management table 400 shown in Fig. 24 and the mask register information management table 500 shown in Fig. 24, and determines that line=121 is kind=LD and line=Final_point[1]. Since line=Final_point[1], the instruction conversion device 100 determines that the subsequent instruction lines can be executed normally even without saving the value of the mask register of ID=1, and determines that a save instruction to save the value of the mask register is unnecessary.

[0148] Therefore, the instruction conversion device 100 converts the load instruction of line=121 into a load instruction defined in Armv8-A. The converted load instruction is, for example, an instruction line that specifies reading 64 bits from [memory address], which realizes the same function as the load instruction of line=121. The instruction conversion device 100 inserts the converted load instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 26, the instruction conversion device 100 stores State[1]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 27 and FIG. 28.

[0149] For example, as shown in table 2700 in Fig. 27, the instruction conversion device 100 processes line=122. The instruction conversion device 100 determines that line=122 is kind=SIMD and line>Final_point[1] by referring to the line information management table 400 shown in Fig. 26 and the mask register information management table 500 shown in Fig. 26. Since line>Final_point[1], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=1.

[0150] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=122 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies 8-bit x 64 data additions that realize the same function as the SIMD instruction of line=122. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 28, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=1, so there is no need to update State[1]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 29 and FIG. 30.

[0151] For example, as shown in table 2900 in Fig. 29, the instruction conversion device 100 processes line=450. The instruction conversion device 100 determines that line=450 is kind=SIMD and line>Final_point[0] by referring to the line information management table 400 shown in Fig. 28 and the mask register information management table 500 shown in Fig. 28. Since line>Final_point[0], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=0.

[0152] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=450 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies 8-bit x 64 data addition, which realizes the same function as the SIMD instruction of line=450. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 30, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=0, so there is no need to update State[0]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 31 and FIG. 32.

[0153] For example, as shown in table 3100 in Fig. 31, the instruction conversion device 100 processes line=451. The instruction conversion device 100 determines that line=451 is kind=SIMD and line>Final_point[1] by referring to the line information management table 400 shown in Fig. 30 and the mask register information management table 500 shown in Fig. 30. Since line>Final_point[1], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=1.

[0154] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=451 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies an 8-bit x 64 data addition that realizes the same function as the SIMD instruction of line=451. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 32, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=1, and therefore does not need to update State[1]=64 in the mask register information management table 500.

[0155] In this way, the instruction conversion device 100 converts each instruction line included in the assembler source code 1600 into an instruction line defined in Armv8-A and inserts it into the Armv8-A assembler source code. This allows the instruction conversion device 100 to correctly generate Armv8-A assembler source code. Therefore, the instruction conversion device 100 can reduce the workload on users who require Armv8-A assembler source code.

[0156] Furthermore, the instruction conversion device 100 can reduce the probability that bugs will be included in Armv8-A assembler source code compared to manually generating Armv8-A assembler source code. The instruction conversion device 100 can easily prevent the use of Armv8-A assembler source code that is executable but includes a bug that causes an error in the execution result due to manually generating Armv8-A assembler source code.

[0157] Here, the case where the instruction conversion device 100 converts the IA-64 assembler source code 1600 into the Armv8-A assembler source code has been described, but this is not limiting. For example, the instruction conversion device 100 may convert the Armv8-A assembler source code into the IA-64 assembler source code.

[0158] For example, the instruction conversion device 100 may convert AMD assembler source code into Armv8-A assembler source code. For example, the instruction conversion device 100 may convert Armv8-A assembler source code into AMD assembler source code.

[0159] Also, for example, there may be cases where the instruction conversion device 100 converts assembler source code corresponding to a certain type of CPU into assembler source code corresponding to another type of CPU having different mask register usage rules from those of the first type of CPU.

[0160] Next, a second operation example of the instruction conversion device 100 will be described with reference to FIGS.

[0161] 33 to 49 are explanatory diagrams showing a second operation example of the instruction conversion device 100. In Fig. 33, the instruction conversion device 100 acquires an IA-64 assembler source code 3300 as a conversion target. In the example of Fig. 33, for convenience, instruction lines in the assembler source code 3300 that are neither load instructions nor masked SIMD instructions are omitted.

[0162] In other words, the example of Fig. 33 shows a correspondence between a load instruction and the number of lines of the load instruction in the assembler source code 3300. Also, the example of Fig. 33 shows a correspondence between a masked SIMD instruction and the number of lines of the masked SIMD instruction in the assembler source code 3300. In the following description, the masked SIMD instruction may be simply referred to as a "SIMD instruction." Next, we move on to the description of Figs. 34 and 35.

[0163] 34 and 35, the instruction conversion device 100 prepares to convert an IA-64 assembler source code 3300 into Armv8-A assembler source code executable by an Armv8-A CPU. The instruction conversion device 100, for example, analyzes the IA-64 assembler source code 3300. Specifically, the instruction conversion device 100 analyzes the IA-64 assembler source code 3300 sequentially from the first instruction line. The instruction conversion device 100 generates and updates a line information management table 400 and a mask register information management table 500 based on the analysis result.

[0164] For example, as shown in table 3400 in Fig. 34, the instruction conversion device 100 associates line=10, ID=0, mask bit width=64, and kind=LD for the load instruction of line=10, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the load instruction of line=10. Furthermore, the instruction conversion device 100 associates mask register ID=0, used[0]=1, and Final_point[0]=10 for the load instruction of line=10, and stores them in the mask register information management table 500.

[0165] For example, as shown in table 3400 in FIG. 34, the instruction conversion device 100 associates line=11, ID=0, mask bit width=16, and kind=SIMD for the SIMD instruction of line=11, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=11. Furthermore, the instruction conversion device 100 determines that the mask bit width required by the SIMD instruction of line=11 does not match the immediately preceding mask bit width. For this reason, the instruction conversion device 100 updates Final_point[0]=11 in the mask register information management table 500.

[0166] For example, as shown in table 3400 in FIG. 34, the instruction conversion device 100 associates line=120, ID=0, mask bit width=64, and kind=SIMD with each other for the SIMD instruction of line=120, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=120. Furthermore, the instruction conversion device 100 determines that the mask bit width required by the SIMD instruction of line=120 does not match the immediately preceding mask bit width. For this reason, the instruction conversion device 100 updates Final_point[0]=120 in the mask register information management table 500.

[0167] For example, as shown in table 3400 in Fig. 34, for the load instruction of line=121, the instruction conversion device 100 associates line=121, ID=1, mask bit width=64, and kind=LD, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the load instruction of line=121. Furthermore, for the load instruction of line=121, the instruction conversion device 100 associates mask register ID=1, used[1]=1, and Final_point[1]=121, and stores them in the mask register information management table 500.

[0168] For example, as shown in table 3400 in FIG. 34, the instruction conversion device 100 associates line=122, ID=1, mask bit width=16, and kind=SIMD with each other for the SIMD instruction of line=122, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=122. The instruction conversion device 100 also determines that the mask bit width required by the SIMD instruction of line=122 does not match the immediately preceding mask bit width. For this reason, the instruction conversion device 100 updates Final_point[1]=122 in the mask register information management table 500.

[0169] For example, as shown in table 3400 in Fig. 34, the instruction conversion device 100 associates line=450, ID=0, mask bit width=64, and kind=SIMD with each other for the SIMD instruction of line=450, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=450. Furthermore, the instruction conversion device 100 does not need to update Final_point[0] in the mask register information management table 500 because the mask bit width required by the SIMD instruction of line=450 matches the immediately preceding mask bit width.

[0170] For example, as shown in table 3400 in FIG. 34, the instruction conversion device 100 associates line=451, ID=1, mask bit width=64, and kind=SIMD with each other for the SIMD instruction of line=451, and stores them in the line information management table 400. The ID is an ID assigned to the mask register that is the target of the SIMD instruction of line=451. Furthermore, the instruction conversion device 100 determines that the mask bit width required by the SIMD instruction of line=451 does not match the immediately preceding mask bit width. For this reason, the instruction conversion device 100 updates Final_point[1]=451 in the mask register information management table 500.

[0171] The instruction conversion device 100 determines that the mask register with used[i]=0 is a free mask register, and stores Reserved[i]=0 for the mask register with used[i]=0 in the mask register information management table 500. As a result, the line information management table 400 and the mask register information management table 500 are in the state shown in Fig. 35. Next, the description will proceed to Figs. 36 to 49.

[0172] 36 to 49, the instruction conversion device 100 converts each instruction line included in the assembler source code 3300 into an instruction line defined in Armv8-A, using the line information management table 400 and the mask register information management table 500. The instruction conversion device 100 generates Armv8-A assembler source code by inserting the converted instruction lines into empty Armv8-A assembler source code.

[0173] In the following description, for convenience, a case where the instruction conversion device 100 converts an instruction line that is neither a load instruction nor a SIMD instruction will be omitted. In the following description, a case where the instruction conversion device 100 converts a load instruction or a SIMD instruction will be described.

[0174] For example, as shown in table 3600 in FIG. 36, the instruction conversion device 100 processes line=10. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 35 and the mask register information management table 500 shown in FIG. 35, and determines that line=10 is kind=LD. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 35 and the mask register information management table 500 shown in FIG. 35, and determines that line=10 is line<=Final_point[0]. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 35 and the mask register information management table 500 shown in FIG. 35, and determines that line=10 is line!=Final_point[0]. The instruction conversion device 100 determines that since line!=Final_point[0], it is preferable to save the value of the mask register of ID=0.

[0175] Therefore, the instruction conversion device 100 converts the load instruction of line=10 into a load instruction defined in Armv8-A and a save instruction for saving the value of the mask register. The converted load instruction is, for example, an instruction line that specifies reading 64 bits from [memory address], which realizes the same function as the load instruction of line=10. The save instruction specifies that the mask register where used!=1 and Reserved[ID]=-1 is set as a reserved register, and the value of the mask register of ID=0 is saved to the set reserved register. In the example of FIG. 35, the mask register of ID=2 is set as a reserved register.

[0176] The instruction conversion device 100 inserts the converted load instruction and save instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 37, the instruction conversion device 100 sets Reserve[0]=2 and Reserved[2]=1 in the mask register information management table 500 for the mask register with ID=2 set in the reserved register. Also, the instruction conversion device 100 stores State[0]=64 in the mask register information management table 500. Next, the description will move to FIG. 38 and FIG. 39.

[0177] For example, as shown in table 3800 in Fig. 38, the instruction conversion device 100 processes line=11. The instruction conversion device 100 determines that kind of line=11 is SIMD by referring to the line information management table 400 shown in Fig. 37 and the mask register information management table 500 shown in Fig. 37. The instruction conversion device 100 determines that line<=Final_point[0] and line!=Final_point[0] by referring to the line information management table 400 shown in Fig. 37 and the mask register information management table 500 shown in Fig. 37.

[0178] Furthermore, the instruction conversion device 100 determines that line=11 is in state!=State[0] by referring to the line information management table 400 shown in Fig. 37 and the mask register information management table 500 shown in Fig. 37. Since state!=State[0], the instruction conversion device 100 determines that it is preferable to change the mask bit width of the mask register with ID=0.

[0179] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=11 into a modification instruction that modifies the mask bit width of the mask register of ID=0, and into a SIMD instruction defined in Armv8-A. The SIMD instruction after conversion is an instruction line that specifies a 32-bit x 16 data addition that achieves the same function as the SIMD instruction of line=11. The modification instruction specifies that the mask bit width is changed from 64 bits to 32 bits.

[0180] The instruction conversion device 100 inserts the converted change instruction and the SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in Fig. 39, the instruction conversion device 100 changes the mask bit width of the mask register with ID=0, and updates the mask register information management table 500 to State[0]=state=16. Next, the description will move to Figs. 40 and 41.

[0181] For example, as shown in table 4000 in Fig. 40, the instruction conversion device 100 processes line=120. The instruction conversion device 100 refers to the line information management table 400 shown in Fig. 39 and the mask register information management table 500 shown in Fig. 39, and determines that line=120 is kind=SIMD. The instruction conversion device 100 refers to the line information management table 400 shown in Fig. 39 and the mask register information management table 500 shown in Fig. 39, and determines that line<=Final_point[0] and line=Final_point[0]. Since line=Final_point[0], the instruction conversion device 100 determines that the reserved register can be released.

[0182] Furthermore, the instruction conversion device 100 refers to the line information management table 400 shown in Fig. 39 and the mask register information management table 500 shown in Fig. 39 and determines that line=120 is in state!=State[0]. The instruction conversion device 100 determines that it is preferable to change the mask bit width of the mask register of ID=0 because state!=State[0]. The instruction conversion device 100 determines that it is preferable to restore the value of the mask register of ID=0 to the saved value because, for example, state=64 and State[0]!=64.

[0183] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=120 into a modification instruction that modifies the mask bit width of the mask register of ID=0, and into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies an 8-bit x 64 data addition that realizes the same function as the SIMD instruction of line=120. The modification instruction is a restore instruction that restores the value of the mask register of ID=0 to the saved value.

[0184] The instruction conversion device 100 inserts the converted change instruction and the SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 41, the instruction conversion device 100 changes the mask bit width of the mask register with ID=0, and updates the mask register information management table 500 to State[0]=state=64. The instruction conversion device 100 changes Reserved[Reserve[0]]=-1 and deletes 2 from Reserve[0], thereby releasing the reserved register. Next, the description will move to FIG. 42 and FIG. 43.

[0185] For example, as shown in table 4200 in FIG. 42, the instruction conversion device 100 processes line=121. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 41 and the mask register information management table 500 shown in FIG. 41, and determines that line=121 is kind=LD. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 41 and the mask register information management table 500 shown in FIG. 41, and determines that line=121 is line<=Final_point[1]. The instruction conversion device 100 refers to the line information management table 400 shown in FIG. 41 and the mask register information management table 500 shown in FIG. 41, and determines that line=121 is line!=Final_point[1]. The instruction conversion device 100 determines that since line!=Final_point[1], it is preferable to save the value of the mask register of ID=1.

[0186] Therefore, the instruction conversion device 100 converts the load instruction of line=121 into a load instruction defined in Armv8-A and a save instruction for saving the value of the mask register. The converted load instruction is, for example, an instruction line that specifies reading 64 bits from [memory address], which realizes the same function as the load instruction of line=121. The save instruction specifies that the mask register where used!=1 and Reserved[ID]=-1 is set as a reserved register, and the value of the mask register of ID=1 is saved to the set reserved register. In the example of FIG. 42, the mask register of ID=2 is set as a reserved register.

[0187] The instruction conversion device 100 inserts the converted load instruction and save instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 43, the instruction conversion device 100 sets Reserve[1]=2 and Reserved[2]=1 in the mask register information management table 500 for the mask register with ID=2 set in the reserved register. Also, the instruction conversion device 100 stores State[1]=64 in the mask register information management table 500. Next, the description will move to FIG. 44 and FIG. 45.

[0188] For example, as shown in table 4400 in Fig. 44, the instruction conversion device 100 processes line=122. The instruction conversion device 100 determines that line=122 is of kind=SIMD by referring to the line information management table 400 shown in Fig. 43 and the mask register information management table 500 shown in Fig. 43. The instruction conversion device 100 determines that line<=Final_point[1] and line!=Final_point[1] by referring to the line information management table 400 shown in Fig. 43 and the mask register information management table 500 shown in Fig. 43.

[0189] Furthermore, the instruction conversion device 100 determines that line=122 is in state!=State[1] by referring to the line information management table 400 shown in Fig. 43 and the mask register information management table 500 shown in Fig. 43. Since state!=State[1], the instruction conversion device 100 determines that it is preferable to change the mask bit width of the mask register with ID=1.

[0190] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=122 into a modification instruction that modifies the mask bit width of the mask register of ID=1 and a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies a 32-bit x 16 data addition that achieves the same function as the SIMD instruction of line=122. The modification instruction specifies that the mask bit width is changed from 64 bits to 32 bits.

[0191] The instruction conversion device 100 inserts the converted change instruction and the SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 45, the instruction conversion device 100 changes the mask bit width of the mask register with ID=1, and updates the mask register information management table 500 to State[1]=state=16. Next, the description will move to FIG. 46 and FIG. 47.

[0192] For example, as shown in table 4600 in Fig. 46, the instruction conversion device 100 processes line=450. The instruction conversion device 100 refers to the line information management table 400 shown in Fig. 45 and the mask register information management table 500 shown in Fig. 45, and determines that line=450 is kind=SIMD. The instruction conversion device 100 refers to the line information management table 400 shown in Fig. 45 and the mask register information management table 500 shown in Fig. 45, and determines that line>Final_point[0]. Since line>Final_point[0], the instruction conversion device 100 determines that the SIMD instruction can be normally executed without changing the mask bit width of the mask register with ID=0.

[0193] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=450 into a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies 8-bit x 64 data additions that realize the same function as the SIMD instruction of line=450. The instruction conversion device 100 inserts the converted SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 47, the instruction conversion device 100 does not change the mask bit width of the mask register of ID=0, so there is no need to update State[0]=64 in the mask register information management table 500. Next, we move on to the description of FIG. 48 and FIG. 49.

[0194] For example, as shown in table 4800 in Fig. 48, the instruction conversion device 100 processes line=451. The instruction conversion device 100 determines that line=451 is kind=SIMD by referring to the line information management table 400 shown in Fig. 47 and the mask register information management table 500 shown in Fig. 47. The instruction conversion device 100 determines that line<=Final_point[1] and line=Final_point[1] by referring to the line information management table 400 shown in Fig. 47 and the mask register information management table 500 shown in Fig. 47. The instruction conversion device 100 determines that line=Final_point[1] and line=Final_point[1]. Since line=Final_point[1], the instruction conversion device 100 determines that the reserved register can be released.

[0195] Furthermore, the instruction conversion device 100 refers to the line information management table 400 shown in Fig. 47 and the mask register information management table 500 shown in Fig. 47 and determines that line=451 is in state!=State[1]. Since state!=State[1], the instruction conversion device 100 determines that it is preferable to change the mask bit width of the mask register of ID=1. For example, since state=64 and State[1]!=64, the instruction conversion device 100 determines that it is preferable to restore the value of the mask register of ID=1 to the saved value.

[0196] Therefore, the instruction conversion device 100 converts the SIMD instruction of line=451 into a modification instruction that modifies the mask bit width of the mask register of ID=1 and a SIMD instruction defined in Armv8-A. The converted SIMD instruction is an instruction line that specifies an 8-bit x 64 data addition that realizes the same function as the SIMD instruction of line=451. The modification instruction is a restore instruction that restores the value of the mask register of ID=1 to the saved value.

[0197] The instruction conversion device 100 inserts the converted change instruction and the SIMD instruction into the assembler source code of Armv8-A. Then, for example, as shown in FIG. 49, the instruction conversion device 100 changes the mask bit width of the mask register with ID=1, and updates the mask register information management table 500 to State[1]=state=64. The instruction conversion device 100 changes Reserved[Reserve[1]]=-1 and deletes 2 from Reserve[1], thereby releasing the reserved register.

[0198] In this way, the instruction conversion device 100 converts each instruction line included in the assembler source code 3300 into an instruction line defined in Armv8-A and inserts it into the Armv8-A assembler source code. This allows the instruction conversion device 100 to correctly generate Armv8-A assembler source code. Therefore, the instruction conversion device 100 can reduce the workload on users who require Armv8-A assembler source code.

[0199] Furthermore, the instruction conversion device 100 can reduce the probability that bugs will be included in Armv8-A assembler source code compared to manually generating Armv8-A assembler source code. The instruction conversion device 100 can easily prevent the use of Armv8-A assembler source code that is executable but includes a bug that causes an error in the execution result due to manually generating Armv8-A assembler source code.

[0200] The instruction conversion device 100 can appropriately release the reserved register, thereby preventing a shortage of free mask registers. Therefore, the instruction conversion device 100 can reduce the probability that a shortage of free mask registers causes the value of the mask register to be saved to a storage area in memory instead of to another mask register, resulting in a decrease in the processing efficiency of Armv8-A assembler source code.

[0201] Specifically, when the mask bit width of the mask register is changed from 64 bits to another mask bit width such as 32 bits, 16 bits, or 8 bits, it is difficult to return the mask bit width of the mask register to 64 bits based on the changed mask register. For this reason, it is preferable to save the value of the mask register in a state where the mask bit width is 64 bits to another storage area. The storage area to which the value is saved is preferably an empty mask register that has a faster access speed than a storage area in memory.

[0202] Here, if there are no free mask registers remaining, the value of the mask register with a mask bit width of 64 bits will be saved to a storage area in memory. In this case, the processing efficiency of the Armv8-A assembler source code will decrease. In response to this, the instruction conversion device 100 can appropriately release the reserved registers and reduce the probability that the processing efficiency of the Armv8-A assembler source code will decrease.

[0203] Here, the case where the instruction conversion device 100 converts the IA-64 assembler source code 3300 into the Armv8-A assembler source code has been described, but this is not limiting. For example, the instruction conversion device 100 may convert the Armv8-A assembler source code into the IA-64 assembler source code.

[0204] For example, the instruction conversion device 100 may convert AMD assembler source code into Armv8-A assembler source code. For example, the instruction conversion device 100 may convert Armv8-A assembler source code into AMD assembler source code.

[0205] Also, for example, there may be cases where the instruction conversion device 100 converts assembler source code corresponding to a certain type of CPU into assembler source code corresponding to another type of CPU having different mask register usage rules from those of the first type of CPU.

[0206] Here, the case has been described in which the instruction conversion device 100 determines whether the reserved register can be released, and releases the reserved register if it can be released, but this is not limited thereto. For example, the instruction conversion device 100 may not determine whether the reserved register can be released, and may not release the reserved register. Even in this case, the instruction conversion device 100 can reduce the workload on a user who requests an assembler source code of Armv8-A. In addition, the instruction conversion device 100 can reduce the probability that a bug is included in the assembler source code of Armv8-A.

[0207] (Overall processing procedure) Next, an example of an overall processing procedure executed by the command conversion device 100 will be described with reference to Fig. 50. The overall processing is realized by, for example, the CPU 301, storage areas such as the memory 302 and the recording medium 305, and the network I / F 303 shown in Fig. 3.

[0208] Fig. 50 is a flowchart showing an example of an overall processing procedure. In Fig. 50, the instruction conversion device 100 initializes the line information management table 400 (step S5001). In addition, the instruction conversion device 100 initializes the mask register information management table 500 (step S5002).

[0209] Next, the instruction conversion device 100 selects, as the processing target of the first loop, the first instruction line among the instruction lines included in the IA-64 assembler source code and which have not yet been selected as the processing target of the first loop (step S5003).Then, the instruction conversion device 100 executes the processing of the first loop, which will be described later with reference to FIG. 51 (step S5004).

[0210] Next, the instruction conversion device 100 judges whether or not all the instruction lines of the assembler source code have been selected as the processing target for the first loop (step S5005). If there are any instruction lines that have not been selected (step S5005: No), the instruction conversion device 100 returns to the processing of step S5003. On the other hand, if all the instruction lines have been selected (step S5005: Yes), the instruction conversion device 100 proceeds to the processing of step S5006.

[0211] In step S5006, the instruction conversion device 100 selects, as a processing target for the second loop, the first instruction line among the instruction lines included in the assembler source code and not yet selected as a processing target for the second loop (step S5006). Next, the instruction conversion device 100 executes the second loop processing described later in FIG. 52 (step S5007).

[0212] Then, the instruction conversion device 100 judges whether or not all the instruction lines of the assembler source code have been selected as processing targets for the second loop (step S5008). If there are any instruction lines that have not been selected (step S5008: No), the instruction conversion device 100 returns to the process of step S5006. On the other hand, if all the instruction lines have been selected (step S5008: Yes), the instruction conversion device 100 ends the entire process.

[0213] (First loop processing procedure) Next, an example of a first loop process procedure executed by the instruction conversion device 100 will be described with reference to Fig. 51. The first loop process is realized by, for example, the CPU 301, storage areas such as the memory 302 and the recording medium 305, and the network I / F 303 shown in Fig. 3.

[0214] Fig. 51 is a flowchart showing an example of a first loop processing procedure. In Fig. 51, the instruction conversion device 100 judges whether or not the selected instruction line is a load instruction for a mask register (step S5101). If it is not a load instruction (step S5101: No), the instruction conversion device 100 proceeds to processing of step S5104. On the other hand, if it is a load instruction (step S5101: Yes), the instruction conversion device 100 proceeds to processing of step S5102.

[0215] In step S5102, the instruction conversion device 100 registers the number of lines of the selected instruction line, the mask bit width of the mask register, and kind=LD in association with the ID of the mask register in the line information management table 400 (step S5102). Next, the instruction conversion device 100 sets used[ID]=1 and Final_point[ID]=the number of lines of the selected instruction line in the mask register information management table 500 (step S5103). Then, the instruction conversion device 100 proceeds to the process of step S5104.

[0216] In step S5104, the instruction conversion device 100 determines whether the selected instruction line is a masked SIMD instruction (step S5104). If the selected instruction line is not a masked SIMD instruction (step S5104: No), the instruction conversion device 100 ends the first loop process. On the other hand, if the selected instruction line is a masked SIMD instruction (step S5104: Yes), the instruction conversion device 100 proceeds to the process of step S5105.

[0217] In step S5105, the instruction conversion device 100 registers the number of lines of the selected instruction line, the mask bit width of the mask register, and kind=SIMD in association with the ID of the mask register in the line information management table 400 (step S5105). The mask bit width is the mask bit width required by the selected instruction line.

[0218] Next, the instruction conversion device 100 sets Final_point[ID]=the number of lines of the selected instruction line in the mask register information management table 500 (step S5106). Specifically, the instruction conversion device 100 may set Final_point[ID]=the number of lines of the selected instruction line only when the mask bit width required by the selected instruction line does not match the immediately preceding mask bit width. Then, the instruction conversion device 100 ends the first loop process.

[0219] (Second loop processing procedure) Next, an example of the second loop process procedure executed by the instruction conversion device 100 will be described with reference to Figures 52 to 55. The second loop process is realized by, for example, the CPU 301, storage areas such as the memory 302 and the recording medium 305, and the network I / F 303 shown in Figure 3.

[0220] 52 to 55 are flowcharts showing an example of the second loop processing procedure. In Fig. 52, the instruction conversion device 100 judges whether or not the number of lines of the selected command line is stored in the line information management table 400 (step S5201). If the number of lines of the selected command line is stored (step S5201: Yes), the instruction conversion device 100 proceeds to processing of step S5203. On the other hand, if the number of lines of the selected command line is not stored (step S5201: No), the instruction conversion device 100 proceeds to processing of step S5202.

[0221] In step S5202, the instruction conversion device 100 generates an instruction line defined in Armv8-A that corresponds to the selected instruction line, and inserts the generated instruction line into the converted assembler source code (step S5202). Then, the instruction conversion device 100 ends the second loop process.

[0222] In step S5203, the instruction conversion device 100 determines whether the kind stored in the line information management table 400 in association with the number of lines of the selected instruction line is LD or not (step S5203). If the kind is SIMD and not LD (step S5203: No), the instruction conversion device 100 proceeds to processing of step S5401 in Fig. 54. On the other hand, if the kind is LD (step S5203: Yes), the instruction conversion device 100 proceeds to processing of step S5204.

[0223] In step S5204, the instruction conversion device 100 generates a load instruction defined in Armv8-A that reads 64 bits of data from the [memory address] and copies it to a mask register, and inserts it into the converted assembler source code (step S5204). Here, the mask register to be copied is identified by an ID stored in the line information management table 400 in association with the line number of the selected instruction line.

[0224] Next, the instruction conversion device 100 sets State[ID]=64 (step S5205). Then, the instruction conversion device 100 proceeds to the process of step S5301 in Fig. 53. Next, the description of Fig. 53 will be given.

[0225] 53, the instruction conversion device 100 judges whether or not Final_point[ID]=the number of lines in the selected instruction line (step S5301). If Final_point[ID]=the number of lines in the selected instruction line (step S5301: Yes), the instruction conversion device 100 proceeds to processing in step S5302. On the other hand, if Final_point[ID]=not the number of lines in the selected instruction line (step S5301: No), the instruction conversion device 100 proceeds to processing in step S5304.

[0226] In step S5302, the instruction conversion device 100 determines whether or not there is an ID where Reserve[ID]!=-1 (step S5302). If there is an ID (step S5302: Yes), the instruction conversion device 100 deletes ID' from Reserve[ID], sets Reserved[ID']=-1 (step S5303), and ends the second loop processing. On the other hand, if there is no ID (step S5302: No), the instruction conversion device 100 ends the second loop processing.

[0227] In step S5304, the instruction conversion device 100 determines whether or not an ID with used[ID]=0 exists (step S5304). If an ID with used[ID]=0 exists (step S5304: Yes), the instruction conversion device 100 proceeds to processing of step S5305. On the other hand, if an ID with used[ID]=0 does not exist (step S5304: No), the instruction conversion device 100 proceeds to processing of step S5307.

[0228] In step S5305, the instruction conversion device 100 sets Reserve[ID]=ID', Reserved[ID']=ID (step S5305). Next, the instruction conversion device 100 generates a save instruction defined in Armv8-A that saves the value of the mask register indicated by ID to the mask register indicated by ID', and inserts it into the converted assembler source code (step S5306). After that, the instruction conversion device 100 ends the second loop processing.

[0229] In step S5307, the instruction conversion device 100 sets Reserve[ID]=stack (step S5307). Next, the instruction conversion device 100 generates a save instruction to memory defined in Armv8-A and inserts it into the converted assembler source code (step S5308). After that, the instruction conversion device 100 ends the second loop processing. Next, the description of FIG. 54 will be made.

[0230] In Fig. 54, the instruction conversion device 100 judges whether or not Final_point[ID]>the number of lines in the selected command line (step S5401). If Final_point[ID]>the number of lines in the selected command line is not satisfied (step S5401: No), the instruction conversion device 100 proceeds to processing of step S5501 in Fig. 55. On the other hand, if Final_point[ID]>the number of lines in the selected command line (step S5401: Yes), the instruction conversion device 100 proceeds to processing of step S5402.

[0231] In step S5402, the instruction conversion device 100 judges whether or not the state stored in the line information management table 400 in association with the number of lines of the selected command line matches State[ID] (step S5402). If the state matches State[ID] (step S5402: Yes), the instruction conversion device 100 proceeds to processing of step S5405. On the other hand, if the state does not match State[ID] (step S5402: No), the instruction conversion device 100 proceeds to processing of step S5403.

[0232] In step S5403, the instruction conversion device 100 generates a change instruction defined in Armv8-A that changes the value of the mask register to match the mask bit width required by the masked SIMD instruction, and inserts the change instruction into the converted assembler source code (step S5403). Next, the instruction conversion device 100 sets State[ID]=state (step S5404). Then, the instruction conversion device 100 proceeds to the process of step S5405.

[0233] In step S5405, the instruction conversion device 100 generates a masked SIMD instruction defined in Armv8-A and inserts it into the converted assembler source code (step S5405). Then, the instruction conversion device 100 ends the second loop processing. Next, the description of FIG. 55 will be made.

[0234] 55, the instruction conversion device 100 judges whether or not Final_point[ID]=the number of lines in the selected instruction line (step S5501). If Final_point[ID]=not the number of lines in the selected instruction line (step S5501: No), the instruction conversion device 100 proceeds to processing of step S5507. On the other hand, if Final_point[ID]=the number of lines in the selected instruction line (step S5501: Yes), the instruction conversion device 100 proceeds to processing of step S5502.

[0235] In step S5502, the instruction conversion device 100 determines whether or not the state stored in the line information management table 400 in association with the number of lines of the selected command line matches State[ID] (step S5502). If the state matches State[ID] (step S5502: Yes), the instruction conversion device 100 proceeds to processing of step S5505. On the other hand, if the state does not match State[ID] (step S5502: No), the instruction conversion device 100 proceeds to processing of step S5503.

[0236] In step S5503, the instruction conversion device 100 generates a change instruction defined in Armv8-A that changes the value of the mask register to match the mask bit width required by the masked SIMD instruction, and inserts the change instruction into the converted assembler source code (step S5503). Next, the instruction conversion device 100 sets State[ID]=state (step S5504). Then, the instruction conversion device 100 proceeds to the process of step S5505.

[0237] In step S5505, the instruction conversion device 100 sets Reserved[Reserve[ID]]=-1 and deletes the ID of the mask register from Reserve[ID] (step S5505). Next, the instruction conversion device 100 generates a masked SIMD instruction defined in Armv8-A and inserts it into the converted assembler source code (step S5506). Then, the instruction conversion device 100 ends the second loop process.

[0238] In step S5507, the instruction conversion device 100 generates a masked SIMD instruction defined in Armv8-A and inserts it into the converted assembler source code (step S5507). Then, the instruction conversion device 100 ends the second loop process.

[0239] Here, the instruction conversion device 100 may switch the order of the processes of some steps in the flowcharts of Figures 50 to 55. For example, the order of the processes of steps S5101 to S5103 and the processes of steps S5104 to S5106 can be switched. Here, the case where the instruction conversion device 100 converts IA-64 assembler source code into Armv8-A assembler source code has been described, but this is not limiting. For example, there may be a case where the instruction conversion device 100 converts Armv8-A assembler source code into IA-64 assembler source code.

[0240] As described above, the instruction conversion device 100 can obtain a first source code corresponding to a first type of processor. The instruction conversion device 100 can convert a first load instruction for a first mask register of a first type of processor in the first source code into a second load instruction for a second mask register of a second type of processor. The instruction conversion device 100 can determine whether or not a first SIMD instruction that performs an operation using the first mask register exists after the first load instruction in the first source code. If the first SIMD instruction exists, the instruction conversion device 100 can determine whether or not the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register. If they do not match, the instruction conversion device 100 can convert the first SIMD instruction into a second SIMD instruction corresponding to a second type of processor and a change instruction that changes the value state of the second mask register to the value state of the second mask register required by the second SIMD instruction. As a result, the instruction conversion device 100 can generate a second load instruction that realizes the same function as the first load instruction and can be correctly executed by the second type of processor. Also, the instruction conversion device 100 can generate a pair of a second SIMD instruction and a modification instruction that realizes the same function as the first SIMD instruction and can be correctly executed by the second type of processor. Therefore, the instruction conversion device 100 can easily generate source code that can be correctly executed by the second type of processor.

[0241] According to the instruction conversion device 100, if the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register, the first SIMD instruction can be converted into a second SIMD instruction. This makes it easier for the instruction conversion device 100 to generate source code that can be correctly executed by the second type of processor. The instruction conversion device 100 does not generate a change instruction, and can reduce the amount of processing.

[0242] According to the instruction conversion device 100, if a first SIMD instruction exists after the first load instruction, the first load instruction can be converted into a second load instruction and a save instruction for saving the value of the second mask register to a third mask register of the second type of processor. This allows the instruction conversion device 100 to restore the value of the second mask register, making it easier to generate source code that can be correctly executed by the second type of processor.

[0243] According to the instruction conversion device 100, it is possible to determine whether or not the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register. According to the instruction conversion device 100, it is possible to determine whether or not there is another SIMD instruction that performs an operation using the first mask register after the first SIMD instruction in the first source code. According to the instruction conversion device 100, if there is no match and no other SIMD instruction exists, it is possible to convert the first SIMD instruction into a second SIMD instruction and a modification instruction, and release the third mask register. This makes it possible for the instruction conversion device 100 to easily secure a free mask register. The instruction conversion device 100 can reduce the amount of processing of source code that can be correctly executed by the second type of processor.

[0244] According to the instruction conversion device 100, it is possible to determine whether or not the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register. According to the instruction conversion device 100, it is possible to determine whether or not the value state of the first mask register required by another SIMD instruction that exists after the first SIMD instruction and performs an operation using the first mask register matches the value state of the first mask register. There are cases where it is determined that the value state of the first mask register required by the first SIMD instruction does not match the value state of the first mask register, and the value state of the first mask register required by the other SIMD instruction matches the value state of the first mask register. In this case, according to the instruction conversion device 100, the first SIMD instruction can be converted into a second SIMD instruction and a modification instruction, and the third mask register can be released. This makes it easier for the instruction conversion device 100 to secure a free mask register. The instruction conversion device 100 can reduce the amount of processing of source code that can be correctly executed by the second type of processor.

[0245] According to the instruction conversion device 100, an instruction that is neither a load instruction nor a SIMD instruction in the first source code can be converted into an instruction that is compatible with a second type of processor and that realizes a function corresponding to the instruction. This makes it easier for the instruction conversion device 100 to generate source code that can be correctly executed by the second type of processor.

[0246] The instruction conversion device 100 can convert a first load instruction included in a first source code corresponding to a first type of processor into a second load instruction corresponding to a second type of processor having different rules for using a mask register from those of the first type of processor. The instruction conversion device 100 can convert a first SIMD instruction included in a first source code corresponding to a first type of processor into a second SIMD instruction corresponding to a second type of processor having different rules for using a mask register from those of the first type of processor. This makes it easier for the instruction conversion device 100 to generate a second source code written in assembly language that can be correctly executed by a second type of processor having different rules for using a mask register from those of the first type of processor.

[0247] The first source code written in assembly language can be acquired by the instruction conversion device 100. This allows the instruction conversion device 100 to process the first source code written in assembly language, and makes it easier to generate a second source code written in assembly language that can be correctly executed by a second type of processor.

[0248] The command conversion method described in this embodiment can be realized by executing a prepared program on a computer such as a PC or a workstation. The command conversion program described in this embodiment is recorded on a computer-readable recording medium, and is executed by being read from the recording medium by the computer. The recording medium may be a hard disk, a flexible disk, a CD (Compact Disc)-ROM, an MO (Magneto Optical disc), a DVD (Digital Versatile Disc), or the like. The command conversion program described in this embodiment may also be distributed via a network such as the Internet.

[0249] The following supplementary notes are further disclosed regarding the above-described embodiment.

[0250] (Supplementary Note 1) A first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor is converted into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, converting the first SIMD instruction into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion program that causes a computer to execute a process.

[0251] (Note 2) The process of converting the first SIMD instruction includes: 2. The instruction conversion program according to claim 1, further comprising: converting the first SIMD instruction into the second SIMD instruction if the value state of the first mask register required by the first SIMD instruction matches the value state of the first mask register.

[0252] (Note 3) The process of converting the first load instruction includes: 3. The instruction conversion program according to claim 1 or 2, characterized in that, if the first SIMD instruction is present after the first load instruction in the first source code, the first load instruction is converted into the second load instruction and a save instruction for saving the value of the second mask register to a third mask register of the second type of processor.

[0253] (Note 4) The process of converting the first SIMD instruction includes: the instruction conversion program according to claim 3, characterized in that if a value state of the first mask register required by the first SIMD instruction does not match a value state of the first mask register and if there is no other SIMD instruction performing an operation using the first mask register after the first SIMD instruction in the first source code, the first SIMD instruction is converted into the second SIMD instruction and the modification instruction, and the third mask register is released.

[0254] (Supplementary Note 5) The process of converting the first SIMD instruction includes: the instruction conversion program according to claim 3 or 4, wherein if a value state of the first mask register required by the first SIMD instruction does not match a value state of the first mask register, and if another SIMD instruction that performs an operation using the first mask register exists after the first SIMD instruction in the first source code, and a value state of the first mask register required by the other SIMD instruction matches a value state of the first mask register, the first SIMD instruction is converted into the second SIMD instruction and the modification instruction, and the third mask register is released.

[0255] (Appendix 6) Converting an instruction that is neither a load instruction nor a SIMD instruction in the first source code into an instruction corresponding to the second type of processor that realizes a function corresponding to the instruction, 6. The instruction conversion program according to any one of claims 1 to 5, which causes the computer to execute a process.

[0256] (Supplementary Note 7) The instruction conversion program according to any one of Supplementary Notes 1 to 6, wherein a usage rule of a mask register by the first type of processor is different from a usage rule of a mask register by the second type of processor.

[0257] (Supplementary Note 8) The instruction conversion program according to any one of Supplementary Notes 1 to 7, wherein the first source code is written in an assembly language.

[0258] (Supplementary Note 9) A first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor is converted into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, converting the first SIMD instruction into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion method, characterized in that processing is executed by a computer.

[0259] (Supplementary Note 10) A first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor is converted into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, converting the first SIMD instruction into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion device having a control unit. [Explanation of symbols]

[0260] 100 Command conversion device 101,102,301 CPU 103,104 Assembler 105 First Source Code 106,107 Executable files 108 Second Source Code 110 First Mask Register 120 Second Mask Register 200 Source Code Conversion System 201 First client device 202 Second client device 210 Network 300 Bus 302 Memory 303 Network Interface 304 Recording media I / F 305 Recording media 400 line information management table 500 Mask register information management table 600 Storage section 601 Acquisition Department 602 Specific part 603 First conversion unit 604 Second conversion unit 605 Third Conversion Unit 606 Output section 1600,3300 assembler source code 1700,1900,2100,2300,2500,2700,2900,3100,3400,3600,3800,4000,4200,4400,4600,4800 Table

Claims

1. converting a first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, the first SIMD instruction is converted into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion program that causes a computer to execute a process.

2. The process of converting the first SIMD instruction includes:

2. The instruction conversion program according to claim 1, wherein the first SIMD instruction is converted to the second SIMD instruction if a value state of the first mask register required by the first SIMD instruction matches a value state of the first mask register.

3. The process of converting the first load instruction includes:

3. The instruction conversion program according to claim 1, further comprising: a program for converting a first SIMD instruction into a second load instruction and a save instruction for saving a value of the second mask register to a third mask register of the second type of processor if the first SIMD instruction is present after the first load instruction in the first source code.

4. The process of converting the first SIMD instruction includes:

4. The instruction conversion program according to claim 3, wherein if a value state of the first mask register required by the first SIMD instruction does not match a value state of the first mask register and if there is no other SIMD instruction performing an operation using the first mask register after the first SIMD instruction in the first source code, the first SIMD instruction is converted into the second SIMD instruction and the modification instruction, and the third mask register is released.

5. The process of converting the first SIMD instruction includes:

5. The instruction conversion program according to claim 3, wherein if a value state of the first mask register required by the first SIMD instruction does not match a value state of the first mask register, and if another SIMD instruction that performs an operation using the first mask register exists after the first SIMD instruction in the first source code, and a value state of the first mask register required by the other SIMD instruction matches a value state of the first mask register, the first SIMD instruction is converted into the second SIMD instruction and the modification instruction, and the third mask register is released.

6. converting a first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, the first SIMD instruction is converted into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion method, characterized in that processing is executed by a computer.

7. converting a first load instruction for a first mask register of a first type of processor in a first source code corresponding to the first type of processor into a second load instruction for a second mask register of a second type of processor different from the first type; if a first SIMD (Single Instruction Multiple Data) instruction for performing an operation using the first mask register is present after the first load instruction in the first source code, and a value state of the first mask register requested by the first SIMD instruction does not match a value state of the first mask register, the first SIMD instruction is converted into a second SIMD instruction corresponding to the second type of processor and a change instruction for changing a value state of the second mask register to a value state of the second mask register requested by the second SIMD instruction; An instruction conversion device having a control unit.

Citation Information

Patent Citations

  • Method and device for creating SIMD instruction sequence and program for creating SIMD instruction sequence

    JP2004164163A

  • Instructions and logic to vectorize conditional loops

    JP2014130580A

  • Translation of SIMD instructions in a data processing system

    US20080141012A1